/** * Three-tier color engine for the terminal UI design system. * * Automatically detects terminal color capability and degrades gracefully: * truecolor (24-bit RGB) → 256-color → 16 ANSI → no color * * Respects NO_COLOR, COLORTERM, and TERM environment variables. */ import type { ColorTokens } from "./tokens.ts"; export type ColorDepth = "none" | "ansi16" | "ansi256" | "truecolor"; /** * Detect the terminal's maximum supported color depth. * Checks environment variables in order of specificity. */ export declare function detectColorDepth(): ColorDepth; /** * Check if the current environment supports truecolor. */ export declare function supportsTrueColor(): boolean; /** * Check if the current environment supports any color. */ export declare function supportsColor(): boolean; export interface ColorTheme { /** Current detected color depth */ readonly depth: ColorDepth; /** * Apply a foreground color token to text. * @param tokenName - Name of the semantic token * @param text - Text to color * @returns Styled text string */ fg(tokenName: keyof ColorTokens["fg"], text: string): string; /** * Apply a background color token to text. * @param tokenName - Name of the semantic token * @param text - Text to color * @returns Styled text string (with bg color + fg reset) */ bg(tokenName: keyof ColorTokens["bg"], text: string): string; /** * Apply bold to text. */ bold(text: string): string; /** * Apply italic to text. */ italic(text: string): string; /** * Apply underline to text. */ underline(text: string): string; /** * Reset all styles. */ reset(text: string): string; /** * Combine multiple styles. * Example: theme.compose(theme.bold, (t) => theme.fg('accent', t)) */ compose(...styles: Array<(text: string) => string>): (text: string) => string; } /** * Create a ColorTheme from a palette and detected color depth. */ export declare function createColorTheme(tokens: ColorTokens, depth?: ColorDepth): ColorTheme; /** * Create a function that applies a foreground token. */ export declare function fgFn(theme: ColorTheme, token: keyof ColorTokens["fg"]): (text: string) => string; /** * Create a function that applies a background token. */ export declare function bgFn(theme: ColorTheme, token: keyof ColorTokens["bg"]): (text: string) => string; /** * Create a function that applies bold + foreground. */ export declare function boldFgFn(theme: ColorTheme, token: keyof ColorTokens["fg"]): (text: string) => string; //# sourceMappingURL=color-engine.d.ts.map