Variable: c
constc:StyleFunction&object
ANSI color helper with chainable style modifiers.
Type Declaration
isColorSupported
readonlyisColorSupported:boolean
Whether color output is supported (checks NO_COLOR env and terminal).
bgRgb()
bgRgb(
r,g,b):StyleFunction
Create a style function for an RGB background color.
Parameters
r
number
Red component (0-255).
g
number
Green component (0-255).
b
number
Blue component (0-255).
Returns
rgb()
rgb(
r,g,b):StyleFunction
Create a style function for an RGB foreground color.
Parameters
r
number
Red component (0-255).
g
number
Green component (0-255).
b
number
Blue component (0-255).
Returns
strip()
strip(
str):string
Strip all ANSI escape sequences from a string.
Parameters
str
string
The string to strip.
Returns
string
Example
import { c } from 'tjs:readline';
c.red('error!'); // red text
c.bold.green('success'); // bold green text
c.rgb(255, 128, 0)('orange'); // RGB color
c.strip(ansiString); // strip ANSI escapes
c.isColorSupported; // boolean