/** * The semantic color palette the CLI renders human-readable output through. Every member takes a string and returns it wrapped in the corresponding ANSI styling, or * returns it untouched when color is disabled - so a command never branches on "are we colorized" itself; it always calls the palette and lets the palette decide. * * The styling itself is delegated to Node's native `util.styleText`, in keeping with the library's "Node-native first" posture: the platform owns the escape sequences * (and emits precise per-attribute reset codes that nest correctly), while this module owns only the semantic naming and the one-time colorization decision. * * @category CLI */ export interface Palette { blue: (text: string) => string; bold: (text: string) => string; cyan: (text: string) => string; dim: (text: string) => string; gray: (text: string) => string; green: (text: string) => string; magenta: (text: string) => string; red: (text: string) => string; yellow: (text: string) => string; } /** * Build a {@link Palette}. Pass the resolved colorization decision (see {@link colorsEnabled}); the palette holds no I/O and no environment knowledge of its own, so it * is trivially testable - `createPalette(false)` returns a palette whose every member is the identity function. * * @param enabled - Whether to emit ANSI styling. When `false`, every palette member returns its input unchanged. * * @returns The palette. * * @category CLI */ export declare function createPalette(enabled: boolean): Palette; /** * Decide whether color should be emitted to a given stream. Color is on only when the stream is an interactive TTY and the environment does not opt out. We honor the * de-facto `NO_COLOR` standard (any non-empty value disables color) and treat `TERM=dumb` as non-color, matching the conventions every well-behaved CLI follows. * * @param stream - The destination stream (its `isTTY` flag is the primary signal). * @param env - The process environment to read `NO_COLOR` / `TERM` from. * * @returns `true` when ANSI color should be emitted. * * @category CLI */ export declare function colorsEnabled(stream: { isTTY?: boolean; }, env: NodeJS.ProcessEnv): boolean; //# sourceMappingURL=colors.d.ts.map