node.js - How do you set colors using either rgb or hex representation using the very popular colors module? -
how set colors using either rgb or hex representation using popular colors module? https://npmjs.org/package/colors
i read ove documentation , don't see option, however, seems such popular module give control, no?
var colors = require('colors'); colors.settheme({ my_green: '#5a9664', // doesn't work output: 'green', }); console.log("a string wants color.".my_green);
update, putting 1 of comments in question it's not burried: colors module supports browser mode, opens door #hex colors within html tags. settheme doesn't support ansi input array, , takes first half. (the module have smarter wrap string in ansi.)
thanks.
the color format of console cant accept these hex color value: #xxxxxx
need check these file: https://github.com/marak/colors.js/blob/master/colors.js , pass ansi color format value.
as developer describes:
'bold' : ['\x1b[1m', '\x1b[22m'], 'italic' : ['\x1b[3m', '\x1b[23m'], 'underline' : ['\x1b[4m', '\x1b[24m'], 'inverse' : ['\x1b[7m', '\x1b[27m'], 'strikethrough' : ['\x1b[9m', '\x1b[29m'], //grayscale 'white' : ['\x1b[37m', '\x1b[39m'], 'grey' : ['\x1b[90m', '\x1b[39m'], 'black' : ['\x1b[30m', '\x1b[39m'], //colors 'blue' : ['\x1b[34m', '\x1b[39m'], 'cyan' : ['\x1b[36m', '\x1b[39m'], 'green' : ['\x1b[32m', '\x1b[39m'], 'magenta' : ['\x1b[35m', '\x1b[39m'], 'red' : ['\x1b[31m', '\x1b[39m'], 'yellow' : ['\x1b[33m', '\x1b[39m']
Comments
Post a Comment