my-colors
Colorize terminal text for Node
createColor(foreground, background, modifier)
Returns a colorizer function.
Both foreground & background arguments expect a color. A color could be one of the following:
- A supported color name (see list below)
- 0-255 Number - see 256 color palette
- HEX - a hex color string that starts with a hash sign (e.g.
'#1d3ddf'
) - RGB - an array of three values (e.g.
[200, 40, 40]
)
Example:
// my-app.jsconst createColor = ; const warning = ;const msg = ; console
Supported Safe Color Names
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- White
Modifiers
Note: Support may vary between different OS/terminals
- bold
- dim
- italic
- underline
- invert
- strike
Example:
// using hex color foreground, RGB background, and bold & underline modifiers;