🧪 A custom fork of
colors
by Marak Squires, maintained by meo-forkcy for educational and non-commercial use.
📍 Check out the ROADMAP for upcoming features.
💬 Feel free to open issues for feedback or contribute via the develop
branch.
npm i meo-forkcy-colors
black, red, green, yellow, blue, magenta, cyan, white, gray/grey
orange, lightOrange, lightYellow, lime, teal, skyBlue, lightBlue, pink, purple, lightGray
brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite
bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray/bgGrey
bgBrightRed, bgBrightGreen, bgBrightYellow, bgBrightBlue, bgBrightMagenta, bgBrightCyan, bgBrightWhite
reset, bold, dim, italic, underline, inverse, hidden, strikethrough
rainbow, zebra, america, trap, random, gradient
const colors = require('colors');
console.log('hello'.green);
console.log('i like cake'.underline.red);
console.log('inverse'.inverse);
console.log('OMG Rainbows!'.rainbow);
console.log('Trap music!'.trap);
const colors = require('colors/safe');
console.log(colors.green('hello'));
console.log(colors.red.underline('i like cake'));
console.log(colors.inverse('inverse'));
console.log(colors.rainbow('OMG Rainbows!'));
console.log(colors.trap('Trap music!'));
node app.js --no-color
node app.js --color=false
node app.js --color
node app.js --color=always
# or using environment variable
FORCE_COLOR=1 node app.js
colors.enable();
colors.disable();
const name = 'Marak';
console.log(colors.green('Hello %s'), name);
// -> Hello Marak
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: 'red',
link: 'grey',
love: 'pink'
});
console.log('this is an error'.error);
console.log('this is a warning'.warn);
const colors = require('colors/safe');
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: 'red',
link: 'grey',
love: 'pink'
});
console.log(colors.error('this is an error'));
console.log(colors.warn('this is a warning'));
colors.setTheme({
custom: ['red', 'underline'],
});
console.log('styled text'.custom);
// Custom gradient
console.log(colors.gradient('Sunset!', [196, 202, 208, 214, 220, 226]));
// Random preset
console.log(colors.gradient('Random Gradient!'));
🖼 Preview ANSI 256 Colors:
Check examples/ansi256-colors.js
or
🔗 Wikipedia: ANSI Escape Codes
🕵️ Protip: There’s a hidden undocumented style. If you find it, you can summon him...