import type { XtermTheme } from "../components/sandbox-terminal.js"; export type ThemeMode = "dark" | "light"; /** Reads a resolved token value (already `getComputedStyle`-flattened). */ export type TokenReader = (name: string) => string | undefined; /** * The 16 ANSI colors + selection/cursor treatment, designed against the og * OKLCH palette. Hues are borrowed from the og status ramp so terminal color * reads as part of the same system: red≈status-failed(22), green≈status-idle * (155), yellow≈status-running(80), magenta(305), cyan≈200. The ANSI blue and * magenta slots stay chromatic because program output means them; the app * chrome around the terminal is neutral. Dark uses lifted lightness on the * dark neutral ground; light uses deeper, more saturated inks on the * near-white ground. Bright variants add lightness + a touch of chroma. * `black`/`white` and the selection are neutral grey ramp stops (never pure * #000/#fff — that clashes with the calm neutral ground). */ export type AnsiPalette = { black: string; red: string; green: string; yellow: string; blue: string; magenta: string; cyan: string; white: string; brightBlack: string; brightRed: string; brightGreen: string; brightYellow: string; brightBlue: string; brightMagenta: string; brightCyan: string; brightWhite: string; /** Selection wash + its foreground; sits over the terminal ground. */ selectionBackground: string; selectionForeground: string; selectionInactiveBackground: string; }; /** The designed ANSI-16 palette for a theme mode. Pure. */ export declare function ogAnsiPalette(mode: ThemeMode): AnsiPalette; /** * Build a COMPLETE xterm ITheme from token values. Background/foreground/cursor * come from the live `--og-*` tokens (so an embedder's rebrand flows through); * the ANSI-16 + selection come from the designed palette for `mode`. Every ANSI * slot is always set — xterm never falls back to its stock VGA colors. Pure. */ export declare function buildXtermTheme(read: TokenReader, mode: ThemeMode): XtermTheme; /** * Derive a COMPLETE xterm `ITheme` from the live `--og-*` token system on the * DOM. Reads the COMPUTED values so xterm gets concrete colors, detects the * active theme mode, and fills every ANSI slot. Call on mount + re-derive on a * `data-og-theme` flip. SSR-safe: returns undefined off the DOM. * * `root` should be an element INSIDE the themed subtree (e.g. the terminal * container) so nested `[data-og-theme]` themes resolve correctly; when omitted * it falls back to the nearest `[data-og-theme]` element, then documentElement. */ export declare function xtermThemeFromTokens(root?: HTMLElement | null): XtermTheme | undefined; export type ResolvedTerminalFont = { fontFamily: string; fontSize: number; lineHeight: number; }; export type FontOverrides = { fontFamily?: string | undefined; fontSize?: number | undefined; }; /** * Resolve xterm's font from token values. The critical bug this fixes: * `fontFamily: "var(--og-font-mono)"` is measured by xterm via a canvas font * string where `var()` does NOT resolve, so xterm silently mis-measures every * glyph. Here the family is a CONCRETE stack; a `var(` in the input is treated * as unresolved and replaced with the fallback. Pure over a token `read`. */ export declare function resolveTerminalFontFromReader(read: TokenReader, overrides?: FontOverrides): ResolvedTerminalFont; /** DOM wrapper: resolve the terminal font from an element's computed tokens. */ export declare function resolveTerminalFont(el: HTMLElement, overrides?: FontOverrides): ResolvedTerminalFont;