@visulima/ansi
Version:
ANSI escape codes for some terminal swag.
73 lines (72 loc) • 2.51 kB
TypeScript
/**
* Returns a sequence that sets the terminal's default foreground (text) color.
*
* The color may be any string the terminal understands for `OSC 10`, such as an
* X11 color name (`"red"`), a hex value (`"#ff0000"`), or an `XParseColor`
* string (`"rgb:ff/00/00"`, `"rgba:ff/00/00/ff"`).
*
* Sequence: `OSC 10 ; color BEL`
* @param color The color to set the foreground to.
* @returns The `OSC 10` escape sequence.
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands}
*/
declare const setForegroundColor: (color: string) => string;
/**
* Sequence that queries the terminal's current default foreground color.
*
* Sequence: `OSC 10 ; ? BEL`
*/
declare const requestForegroundColor: string;
/**
* Sequence that resets the terminal's default foreground color to its default.
*
* Sequence: `OSC 110 BEL`
*/
declare const resetForegroundColor: string;
/**
* Returns a sequence that sets the terminal's default background color.
*
* The color may be any string the terminal understands for `OSC 11` (X11 color
* name, hex value, or `XParseColor` string).
*
* Sequence: `OSC 11 ; color BEL`
* @param color The color to set the background to.
* @returns The `OSC 11` escape sequence.
*/
declare const setBackgroundColor: (color: string) => string;
/**
* Sequence that queries the terminal's current default background color.
*
* Sequence: `OSC 11 ; ? BEL`
*/
declare const requestBackgroundColor: string;
/**
* Sequence that resets the terminal's default background color to its default.
*
* Sequence: `OSC 111 BEL`
*/
declare const resetBackgroundColor: string;
/**
* Returns a sequence that sets the terminal's cursor color.
*
* The color may be any string the terminal understands for `OSC 12` (X11 color
* name, hex value, or `XParseColor` string).
*
* Sequence: `OSC 12 ; color BEL`
* @param color The color to set the cursor to.
* @returns The `OSC 12` escape sequence.
*/
declare const setCursorColor: (color: string) => string;
/**
* Sequence that queries the terminal's current cursor color.
*
* Sequence: `OSC 12 ; ? BEL`
*/
declare const requestCursorColor: string;
/**
* Sequence that resets the terminal's cursor color to its default.
*
* Sequence: `OSC 112 BEL`
*/
declare const resetCursorColor: string;
export { requestBackgroundColor, requestCursorColor, requestForegroundColor, resetBackgroundColor, resetCursorColor, resetForegroundColor, setBackgroundColor, setCursorColor, setForegroundColor };