/** * Color selector kinds, like less.h's AT_COLOR_* slots plus the * attribute remaps (-Dn, -Ds, -Dd, -Du, -Dk). */ export type ColorKind = 'attn' | 'bin' | 'ctrl' | 'error' | 'header' | 'target' | 'mark' | 'linenum' | 'osc8' | 'prompt' | 'rscroll' | 'search' | 'tilde' | 'sub1' | 'sub2' | 'sub3' | 'sub4' | 'sub5' | 'normal' | 'standout' | 'bold' | 'underline' | 'blink'; /** Restores the default color map, for tests. */ export declare function resetColors(): void; /** * Parses a -D color string into its SGR open sequence, like screen.c's * parse_color feeding tput_color: one or two 4-bit color chars (fg, * bg), or decimal `fg.bg` 256-color values, `-` leaving a side * unchanged, then attribute chars (`*~_&` or `dsul`). Trailing junk is * ignored, like less's cattr loop breaking out. * * @returns The SGR codes (possibly empty), or null when invalid. */ export declare function colorSgr(text: string): string | null; /** * Stores a -D color setting, like opt_D through set_color_map. * * @param text - The selector char followed by the color string. * @returns An less error message, or null on success. */ export declare function setColor(text: string): string | null; /** * Wraps text in its mapped color when --use-color is on, like * at_enter preferring the color over the fallback attribute. * * @param kind - The AT_COLOR slot. * @param text - The text to color. * @param fallbackOn - Attribute opener used without a color. * @param fallbackOff - Attribute closer used without a color. */ export declare function colored(kind: ColorKind, text: string, fallbackOn?: string, fallbackOff?: string): string; /** * Wraps text in a base attribute, honoring a -D remap like * tput_inmode: a plain color replaces the attribute, a `+color` * prefixes the attribute to it. */ export declare function attrText(attr: 'bold' | 'underline' | 'blink' | 'standout', text: string): string;