UNPKG

@visulima/ansi

Version:

ANSI escape codes for some terminal swag.

25 lines (24 loc) 1.11 kB
/** * X11 colour names, as OSC 10/11/12 accept them. * * A terminal may answer a colour query with a name rather than an `rgb:` triplet, and `xterm` and * friends accept one when setting. The values track the X.Org server's `rgb.txt` (v21.1.16). * * Kept in its own module because most callers never resolve a name and should not carry the table. * Names are stored without spaces and in lower case; {@link x11ColorToHex} normalises its argument * the same way, so `"alice blue"`, `"AliceBlue"` and `"ALICEBLUE"` all resolve. */ declare const X11_COLORS: Readonly<Record<string, string>>; /** * Resolves an X11 colour name to its hex value. * @param name The colour name, e.g. `"cornflower blue"`. Case and spaces are ignored. * @returns The colour as `#rrggbb`, or `undefined` when the name is not an X11 colour. * @example * ```typescript * import { x11ColorToHex } from "@visulima/ansi/x11-colors"; * * x11ColorToHex("CornflowerBlue"); // "#6495ed" * ``` */ declare const x11ColorToHex: (name: string) => string | undefined; export { X11_COLORS, x11ColorToHex as default, x11ColorToHex };