/** * Colour and visible width for the watch view (colorful-autopilot-watch/AC-11, * colorful-autopilot-watch/AC-12, colorful-autopilot-watch/AC-14). * * The few escape codes are written by hand rather than taken from a colour * library: the watch already wrote its cursor codes by hand, and one more runtime * dependency is one more package every install fetches (requirements Q2). * * @module */ /** Columns a line takes on screen: code points, with escape codes not counted. */ export declare function visibleWidth(s: string): number; /** * Cut to `max` visible columns, ending in `…`. Escape codes are copied whole and * never counted, so a coloured line is cut only when its text is too wide, and a * cut line ends with the colour reset so it cannot bleed into the next. */ export declare function cutVisible(s: string, max: number): string; /** Pad with spaces to `width` visible columns. */ export declare function padVisible(s: string, width: number): string; /** Plain text wrapped on spaces to `width`; a word longer than a line is split. Never empty. */ export declare function wrapText(text: string, width: number): string[]; export type Hue = 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'grey'; export interface Paint { on: boolean; bold(s: string): string; dim(s: string): string; fg(hue: Hue, s: string): string; /** Black bold text on `hue`: dark text on a light ground reads on dark and light terminals alike. */ badge(hue: Hue, s: string): string; } /** Off, every function returns its text unchanged (colorful-autopilot-watch/AC-12). */ export declare function paint(on: boolean): Paint; /** Colour only on a terminal, and never when `NO_COLOR` is set to anything (no-color.org). */ export declare function colourWanted(tty: boolean, env: NodeJS.ProcessEnv): boolean; //# sourceMappingURL=ansi.d.ts.map