/** * @file Socket terminal-color palette — mirrors the CSS design tokens defined * in Socket's `template/styles/tokens.css` (light / dark / synthwave * themes). Each helper returns the input string wrapped in a 24-bit ANSI * escape sequence so the rendered hex matches the brand exactly; no rounding * to the legacy 8-color palette. Picocolors / yoctocolors only ship a fixed * 8-color ANSI set, which would collapse `#8c50ff` to a generic "magenta". * This module sidesteps that by emitting `\x1b[38;2;R;G;Bm…\x1b[39m` * directly. Zero runtime dependencies. Usage: import { getPalette } from * '@socketsecurity/lib/term/colors/socket-palette' const palette = * getPalette('dark') console.log(palette.success('Done')) // Or read raw hex * values for callers building their own escape codes. * console.log(palette.hex.socketPurple) // "#8c50ff" Pick a theme by passing * `'light' | 'dark' | 'synthwave'`. Defaults to `'dark'` since terminals are * dark-on-light far less often than the opposite. */ /** * Available palette themes — kept in sync with the CSS theme blocks in * template/styles/tokens.css. */ export type SocketPaletteTheme = 'dark' | 'light' | 'synthwave'; /** * Hex-color value for each named slot. Exposed so callers can build their own * ANSI escapes (e.g. for backgrounds, which this module doesn't wrap). */ export interface SocketPaletteHex { alert: string; error: string; info: string; socketPink: string; socketPurple: string; success: string; warning: string; } /** * Color-application helpers. Each takes a string and returns it wrapped in the * matching 24-bit ANSI escape. */ export interface SocketPalette { alert: (s: string) => string; error: (s: string) => string; hex: SocketPaletteHex; info: (s: string) => string; socketPink: (s: string) => string; socketPurple: (s: string) => string; success: (s: string) => string; warning: (s: string) => string; } /** * Build an ANSI-wrapping function for a single hex color. Emits the 24-bit * sequence rather than rounding to the legacy 8-color palette so the rendered * output matches the CSS token byte-for-byte up to the terminal's gamut. * `\x1b[39m` resets fg to the terminal default — using `[0m` would also clear * bg / styles, which the caller may have set deliberately. */ export declare function colorizer(hex: string): (s: string) => string; /** * Resolve a Socket palette for the requested theme. Defaults to `'dark'` — the * common case for terminal output. * * @example * ;```typescript * import { getPalette } from '@socketsecurity/lib/term/colors/socket-palette' * * const palette = getPalette('dark') * process.stdout.write(palette.success('Build complete\n')) * ``` */ export declare function getPalette(theme?: SocketPaletteTheme): SocketPalette;