Adds 256 color support.

This commit is contained in:
Joshua Appelman 2014-07-14 00:23:49 +02:00
parent 03b92b1bb8
commit 79c6bdcfd8
3 changed files with 21 additions and 0 deletions

View file

@ -1,5 +1,6 @@
'use strict';
var escapeStringRegexp = require('escape-string-regexp');
var ansi8bit = require('ansi-8-bit');
var ansiStyles = require('ansi-styles');
var stripAnsi = require('strip-ansi');
var hasAnsi = require('has-ansi');
@ -84,6 +85,14 @@ function init() {
defineProps(chalk, init());
chalk.foreground = function (r, g, b, str) {
return ansi8bit.fg.getRgb(r, g, b) + str + ansi8bit.reset;
};
chalk.background = function (r, g, b, str) {
return ansi8bit.bg.getRgb(r, g, b) + str + ansi8bit.reset;
};
chalk.styles = ansiStyles;
chalk.hasColor = hasAnsi;
chalk.stripColor = stripAnsi;