Giter Club home page Giter Club logo

ansi-styles's Introduction



Chalk


Terminal string styling done right

Coverage Status npm dependents Downloads





Highlights

Install

npm install chalk

IMPORTANT: Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. Read more.

Usage

import chalk from 'chalk';

console.log(chalk.blue('Hello world!'));

Chalk comes with an easy to use composable API where you just chain and nest the styles you want.

import chalk from 'chalk';

const log = console.log;

// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!'));

// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));

// Pass in multiple arguments
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));

// Nest styles
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));

// Nest styles of the same type even (color, underline, background)
log(chalk.green(
	'I am a green line ' +
	chalk.blue.underline.bold('with a blue substring') +
	' that becomes green again!'
));

// ES2015 template literal
log(`
CPU: ${chalk.red('90%')}
RAM: ${chalk.green('40%')}
DISK: ${chalk.yellow('70%')}
`);

// Use RGB colors in terminal emulators that support it.
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
log(chalk.hex('#DEADED').bold('Bold gray!'));

Easily define your own themes:

import chalk from 'chalk';

const error = chalk.bold.red;
const warning = chalk.hex('#FFA500'); // Orange color

console.log(error('Error!'));
console.log(warning('Warning!'));

Take advantage of console.log string substitution:

import chalk from 'chalk';

const name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> 'Hello Sindre'

API

chalk.<style>[.<style>...](string, [string...])

Example: chalk.red.bold.underline('Hello', 'world');

Chain styles and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that chalk.red.yellow.green is equivalent to chalk.green.

Multiple arguments will be separated by space.

chalk.level

Specifies the level of color support.

Color support is automatically detected, but you can override it by setting the level property. You should however only do this in your own code as it applies globally to all Chalk consumers.

If you need to change this in a reusable module, create a new instance:

import {Chalk} from 'chalk';

const customChalk = new Chalk({level: 0});
Level Description
0 All colors disabled
1 Basic color support (16 colors)
2 256 color support
3 Truecolor support (16 million colors)

supportsColor

Detect whether the terminal supports color. Used internally and handled for you, but exposed for convenience.

Can be overridden by the user with the flags --color and --no-color. For situations where using --color is not possible, use the environment variable FORCE_COLOR=1 (level 1), FORCE_COLOR=2 (level 2), or FORCE_COLOR=3 (level 3) to forcefully enable color, or FORCE_COLOR=0 to forcefully disable. The use of FORCE_COLOR overrides all other color support checks.

Explicit 256/Truecolor mode can be enabled using the --color=256 and --color=16m flags, respectively.

chalkStderr and supportsColorStderr

chalkStderr contains a separate instance configured with color support detected for stderr stream instead of stdout. Override rules from supportsColor apply to this too. supportsColorStderr is exposed for convenience.

modifierNames, foregroundColorNames, backgroundColorNames, and colorNames

All supported style strings are exposed as an array of strings for convenience. colorNames is the combination of foregroundColorNames and backgroundColorNames.

This can be useful if you wrap Chalk and need to validate input:

import {modifierNames, foregroundColorNames} from 'chalk';

console.log(modifierNames.includes('bold'));
//=> true

console.log(foregroundColorNames.includes('pink'));
//=> false

Styles

Modifiers

  • reset - Reset the current style.
  • bold - Make the text bold.
  • dim - Make the text have lower opacity.
  • italic - Make the text italic. (Not widely supported)
  • underline - Put a horizontal line below the text. (Not widely supported)
  • overline - Put a horizontal line above the text. (Not widely supported)
  • inverse- Invert background and foreground colors.
  • hidden - Print the text but make it invisible.
  • strikethrough - Puts a horizontal line through the center of the text. (Not widely supported)
  • visible- Print the text only when Chalk has a color level above zero. Can be useful for things that are purely cosmetic.

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • blackBright (alias: gray, grey)
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgBlackBright (alias: bgGray, bgGrey)
  • bgRedBright
  • bgGreenBright
  • bgYellowBright
  • bgBlueBright
  • bgMagentaBright
  • bgCyanBright
  • bgWhiteBright

256 and Truecolor color support

Chalk supports 256 colors and Truecolor (16 million colors) on supported terminal apps.

Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying {level: n} as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).

Examples:

  • chalk.hex('#DEADED').underline('Hello, world!')
  • chalk.rgb(15, 100, 204).inverse('Hello!')

Background versions of these models are prefixed with bg and the first level of the module capitalized (e.g. hex for foreground colors and bgHex for background colors).

  • chalk.bgHex('#DEADED').underline('Hello, world!')
  • chalk.bgRgb(15, 100, 204).inverse('Hello!')

The following color models can be used:

  • rgb - Example: chalk.rgb(255, 136, 0).bold('Orange!')
  • hex - Example: chalk.hex('#FF8800').bold('Orange!')
  • ansi256 - Example: chalk.bgAnsi256(194)('Honeydew, more or less')

Browser support

Since Chrome 69, ANSI escape codes are natively supported in the developer console.

Windows

If you're on Windows, do yourself a favor and use Windows Terminal instead of cmd.exe.

Origin story

colors.js used to be the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of problems and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.

Related

Maintainers

ansi-styles's People

Contributors

arthurvr avatar bluelovers avatar danilobuerger avatar eush77 avatar exe-boss avatar jbnicolai avatar jwalton avatar kevva avatar litomore avatar marionebl avatar nmschulte avatar phated avatar qix- avatar richienb avatar sindresorhus avatar stroncium avatar yash-singh1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansi-styles's Issues

Running xo reports error: Avoid using extended native objects

When running xo to test code, it reports the following error.

test.js:5:26 Avoid using extended native objects

In test.js, this error is due to the use of "Object.entries" -- according to node.green, "Object.entries" is not well supported. Even in Node v6.9.1, it can only be available with "--harmony" tag.

Suggest using "Object.keys" instead of "Object.entries".

Different versions between npm and this repo

I have a weird error. I copied the example from the readme

const style = require('ansi-styles');

console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);

And it fails inmediatly with TypeError: Cannot read property 'ansi256' of undefined.
So I compared the source that I downloaded with npm and I found it is quite different from what is in this repo (I copied the downloaded code below). Now, I think thats strange, but I noticed that the version in the package.json file of this repo is 2.1.0, while the version published to npm is 2.2.1. I think that tha's the problem. Now, I'm not sure why the last version remove the color feature, could you re add it?

'use strict';

function assembleStyles () {
    var styles = {
        modifiers: {
            reset: [0, 0],
            bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
            dim: [2, 22],
            italic: [3, 23],
            underline: [4, 24],
            inverse: [7, 27],
            hidden: [8, 28],
            strikethrough: [9, 29]
        },
        colors: {
            black: [30, 39],
            red: [31, 39],
            green: [32, 39],
            yellow: [33, 39],
            blue: [34, 39],
            magenta: [35, 39],
            cyan: [36, 39],
            white: [37, 39],
            gray: [90, 39]
        },
        bgColors: {
            bgBlack: [40, 49],
            bgRed: [41, 49],
            bgGreen: [42, 49],
            bgYellow: [43, 49],
            bgBlue: [44, 49],
            bgMagenta: [45, 49],
            bgCyan: [46, 49],
            bgWhite: [47, 49]
        }
    };

    // fix humans
    styles.colors.grey = styles.colors.gray;

    Object.keys(styles).forEach(function (groupName) {
        var group = styles[groupName];

        Object.keys(group).forEach(function (styleName) {
            var style = group[styleName];

            styles[styleName] = group[styleName] = {
                open: '\u001b[' + style[0] + 'm',
                close: '\u001b[' + style[1] + 'm'
            };
        });

        Object.defineProperty(styles, groupName, {
            value: group,
            enumerable: false
        });
    });

    return styles;
}

Object.defineProperty(module, 'exports', {
    enumerable: true,
    get: assembleStyles
});

Blinking text

Hi there.

I needed text blinking but I noticed that the package itself does not support it, neither slow nor fast. I managed to handle slow blinking by adding few lines of code but I would like to know if it may be handled by default from the package or if it may bring to errors that i may not know under different situations.
To be honest I am not sure if every terminal act the same way, I have read that fast blinking is not widely supported but slow blinking seems to be quite supported even if not widely used.

Linking some references i found and a preview of the result:
https://stackoverflow.com/questions/17439482/how-to-make-a-text-blink-in-shell-script
https://misc.flogisoft.com/bash/tip_colors_and_formatting
https://en.wikipedia.org/wiki/ANSI_escape_code

blinkingResult

Thanks in advance!

Provide steps for shrinkwrap users to fix their builds after 2.2.0 was unpublished

As suggested in #15 I'm opening this issue to help users who's projects/packages/builds are broken due to version 2.2.0 being unpublished, in particular in regards to version 2.2.0 being listed in npm-shrinkwrap.json.

I manually edited my npm-shrinkwrap.json but this is annoying and error prone, and I'd like to know if there's a better way. Deleting npm-shrinkwrap.json and re-running npm shrinkwrap is not always an option, as I'd like to keep most of the packages locked to their current versions.

Problem from version`5+` to Regex when using ReactNative Hermes engine

Problem is in that line:

const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));

When generating hermes bytecode it is failing because Invalid regular expression: Quantifier has nothing to repeat

Some info here: facebook/hermes#89

I also think it may be related to https://github.com/facebook/jest/blob/master/packages/pretty-format/package.json and its pretty-format package.

NPM and Github versions out of sink?

I was attempting to install the package and noticed that I was missing the code for ANSI 256 and 16m as well as getting a different version (2.2.1) than is in the master branch (2.1.0).

I believe that the NPM package is being published from branch 2.2.1 which I assume was created in response to #15. This branch does not contain any commit since a42e120 on July 01 2015. Am I correct in assuming that this can be rectified in by bumping the version in the main repo to 2.2.2 and then publishing from there?

Many thanks, Josh

Exported Categories

Would the maintainers be open to an export style that groups styles and colors separately? At present version, all styles and colors are exported in the same object on the same level.

Additionally, it appears that the documentation in the README is no longer correct. style.color is now undefined.

256/16 million color support

Yes, it's time.

I spent the greater part of last night trying to figure out the best way to tackle compatibility with ANSI 256/16m (truecolor) support to where colors would degrade nicely. I started writing my own engine but alas I figured this may be better suited as a PR for an existing solution (i.e. Node's biggest package, Chalk). Now that supports-color will soon support more colors, this is a good time to look at it.

There are a few issues issues I foresee with an upgrade such as this:

  • What happens to 256/16m colors on terminals that only support 16 colors ("basic" support)? 16m colors on terminals that only support 256 colors?
  • How do we accurately and easily wrap color operations into an already expressive API, with full backwards compatibility?

Color Operations

The way my engine does it (and the way that seems to work fine) is to use the color-js package to perform color operations on full color values. This includes modifying lightness, saturation, and per-channel values.

These color values can then be converted to 8bpc RGB color values, which can then be used to degrade into the lower forms.

Tests

First of all, let's define our domain scaling function. This function takes a value, along with the upper/lower bound of that value's domain, and then applies it to a lower/upper bound of another domain.

applyDomain = (val, lb, ub, tlb, tub)->
  Math.round ((val - lb) / (ub - lb)) * (tub - tlb) + tlb

From there, degrading colors becomes somewhat of a simple task.

For each of the three levels, I'll be decoding an image using png-js and running the pixel data through each of the functions.

The original image:
applepride

16m (8bpc)

This one is simple. Provided a 0..255 domain of RGB values, we can then build up a pretty lossless result in the terminal.

color-js provides RGB values in floating point numbers in the domain 0.0..1.0. As you might expect, this is easily converted to the 0..255 domain using applyDomain n, 0, 1, 0, 255.

screen shot 2015-06-23 at 5 10 51 pm

16m (8bpc) to ANSI 256

Thanks to this formula (thanks @jbnicolai) we know the per-channel domain of ANSI-256 colors is 0..5 with a translation of +16.

toAnsi256 = (r8, g8, b8)->
  r = applyDomain r8, 0, 255, 0, 5 # red, from 0..255 to 0..5
  g = applyDomain g8, 0, 255, 0, 5 # green, from 0..255 to 0..5
  b = applyDomain b8, 0, 255, 0, 5 # blue, from 0.255 to 0..5
  return (36 * r) + (6 * g) + b + 16

As you can see, it's quite accurate.

screen shot 2015-06-23 at 5 05 56 pm

16m (8bpc) to 16 colors

This one was a little trickier, but really achieves the same effect.

toAnsi16 = (r8, g8, b8)->
  r = applyDomain r8, 0, 255, 0, 1 # red, from 0..255 to 0..1 (rounded)
  g = applyDomain g8, 0, 255, 0, 1 # green, from 0..255 to 0..1 (rounded)
  b = applyDomain b8, 0, 255, 0, 1 # blue, from 0..255 to 0..1 (rounded)
  return (b << 2) | (g << 1) | r

this yields predictable results.

coffee> toAnsi16 = require './ansi16'
[Function]
coffee> toAnsi16 255, 255, 255
7
coffee> toAnsi16 255, 0, 0
1
coffee> toAnsi16 255, 0, 126
1
coffee> toAnsi16 255, 0, 127
1
coffee> toAnsi16 255, 0, 128
5
coffee> toAnsi16 255, 127, 128
5
coffee> toAnsi16 30, 185, 128
6

As you can see, it's also pretty accurate (minus orange, which is a tricky color to get right with the standard 16 color palette).

screen shot 2015-06-23 at 5 03 16 pm

Though by using color-js and the lightness value bound to the domain 0..1 (rounded), then we can select the brightness scheme using the extended 100m-107m bright background codes to get a better result.

screen shot 2015-06-23 at 5 43 10 pm

Much better - and with only the basic functionality (and yes, even Windows supports those).

Internal structure

With the domain functions being pretty accurate, we can then start making assertions about color values. This means we can store color-js Color objects as the main source for color, perform operations on them, and then degrade them down to corresponding command line colors.

For instance, here is my prototype library doing this with a nice shade of Purple. There isn't a ton of logic about the 16 color palette, but I'm sure something could be thrown in there for lightness governing the bold (1m) code.

screen shot 2015-06-23 at 5 18 26 pm


As you can see in the above prototype, we now have a lot of control over the kinds of colors we can output to the console. We can do advanced things like shift by hue, lighten/darken by lightness/value, and even start theming console colors with CSS (if we so choose) - all while being completely degradable by non-supporting terminals.

Existing programs can upgrade their color suites to be more colorful, and if we so choose supports-color could even include or modify an environment variable to allow users to set this in their RC files to enable system-wide 256 or 16 million color terminal applications.

Thoughts? I'm fully prepared to make a complete PR for this.

White is a little off

I took this screenshot using the function chalk.white():
screen shot 2013-09-22 at 10 24 17 pm

Notice how the string "test" is is white, but the first part is kind-of gray?

I changed the white entry to white: ['\x1b[0m', '\x1b[0m'] and now I get:
screen shot 2013-09-22 at 10 24 49 pm

Maybe there is something else wrong with this method, I really don't know what I am doing around terminal colors. I was just messing around.

Why the open/close API

Why does the API expose .open and .close on everything, even though .close is not generally specific to the style? For example console.log(styles.red.open, "I'm red", styles.green.close, "What color am I?") doesn't make a lot of sense...

Cannot read property 'ansi' of undefined

Running example from https://github.com/chalk/ansi-styles

spits out this error in console:

Hello world!
/Users/jeremy/Dev/ascii/ansi.js:10
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
                         ^

TypeError: Cannot read property 'ansi' of undefined
    at Object.<anonymous> (/Users/jeremy/Dev/ascii/ansi.js:10:26)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:138:18)
    at node.js:974:3

Issue in Ansy: IonicaBizau/ansy#1 (comment)

cc @IonicaBizau

Syntax error in IE11 due to arrow function currying

There is an issue in IE11 where I think the transpiler fails to convert the code correctly.
This means it breaks any module that requires this as a dependency.
source

const wrapAnsi16 = (fn, offset) => (...args) => {
	const code = fn(...args);
	return `\u001B[${code + offset}m`;
};

vs

transpiled in IE11

const wrapAnsi16 = (fn, offset) => function () {
  const code = fn.apply(colorConvert, arguments);
  return "\x1B[".concat(code + offset, "m");
};

Please let me know if you need any more details, and thanks for the effort you put into creating /maintaining this.

Can't import into TypeScript node project

I've been using v5.2.0 fine for a while. I just upgraded to v6.1.0 and I can't get the ansi-styles import to work properly anymore.

Here's my v5.2.0 code which used to work:

import * as styles from 'ansi-styles';
console.log(styles.blue.open)

After upgrading to v6.1.0 I get the following TypeScript error:

error TS2339: Property 'blue' does not exist

If I change the code to the following (with v6.1.0) then TypeScript is happy:

import styles from 'ansi-styles';
console.log(styles.blue.open);

but now I get the following error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../node_modules/ansi-styles/index.js
require() of ES modules is not supported.
require() of .../node_modules/ansi-styles/index.js from <my-transpiled-file-path> is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from .../node_modules/ansi-styles/package.json.

I also tried adding "esModuleInterop": true, to my tsconfig.json file and that did not help.

Access specific style types

I want to provide an API that would allow users to pick a color they want text in and use that color with this library to colorize. For example, here is a crude way:

var color = 'blue' // string comes from library user
var str = 'hello!' // computed string
var style = ansi[color]
console.log(style.open + str + style.close)

What would be awesome is if there was a way to tell if style was a color and not something like dim (since I just want them to change the colors). Perhaps ansi.color[color]? Bonus points if I could take the same string ("blue") and get the blue background style. Currently I would have to do: ansi['bg' + color[0].toUppperCase() + color.substr(1)]

Ambiguous error when keyword doesn't exist

A strange error is thrown if the argument thrown to keyword() doesn't exist.

> chalk.keyword('blackfsdfsd')

16:00:00.000 index.js:16 Uncaught TypeError: Cannot read property '0' of undefined
    at /src/chalk/chalk/node_modules/ansi-styles/index.js:16:39
    at Function.<anonymous> (/src/chalk/chalk/index.js:76:63)
    at eval (eval at buildStyle (/src/chalk/chalk/templates.js:68:22), <anonymous>:1:7)
    at buildStyle (/src/chalk/chalk/templates.js:68:22)
    at tmp.replace (/src/chalk/chalk/templates.js:111:16)
    at String.replace (<anonymous>)
    at module.exports (/src/chalk/chalk/templates.js:98:6)
    at chalkTag (/src/chalk/chalk/index.js:214:9)
    at Chalk.chalk.template (/src/chalk/chalk/index.js:36:20)
    at Object.<anonymous> (/src/chalk/chalk/test-tmpl.js:9:14)

Unable to install the package

There is an 404 error during the package installation

Environment

node: 5.4.2
npm: v8.4.0

Steps to reproduce:

  1. run npm i ansi-styles

Actual result:

⋊> ~/P/c/p/about ⨯ npm install ansi-styles                                                            19:34:45
npm ERR! code E404
npm ERR! 404 Not Found: ansi-styles@https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.0.tgz

Expected result:

package should be install successfully

Version not found: [email protected]

I am getting this error when trying to run:

npm install [email protected]

$ npm install [email protected]
npm ERR! Linux 3.13.0-36-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "[email protected]"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7

npm ERR! version not found: [email protected]
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/alexk/delme/npm-debug.log

Did the 2.2.0 release disappear?

I recently began experiencing the following errors:

npm ERR! fetch failed https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.0.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.0.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.0.tgz

This is a dependency of a dependency, not something I'm directly dependent upon. Wondering if the 2.2.1 intentionally replaces due to a security issue?

NPM install error

Hello!
I am trying run npm install command and am getting the error bellow:

npm ERR! fetch failed https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.0.tgz

Any idea?

Colors not shown in Systemd log

I recently switched from "\u001b[31m" (red) style colors to chalk, and for some strange reason, journalctl -o -cat won't show any colors for my app, just a plain default text.

I see that this library does color encoding slightly different (It omits the two zeros and uses \x instead of \u), could that be an issue?

No greenBright open and close

Hey there,

Your readme says you can use:

const style = require('ansi-styles');

console.log(`${style.green.open}Hello world!${style.green.close}`);

And that you support greenBright among others but it's output is missing those new colors:

const style = require('ansi-styles');

console.log( style );

// so running
// console.log(`${style.greenBright.open}Hello world!${style.greenBright.close}`);
// will fail

Above will output this:

{
	reset: {
		open: '\u001b[0m',
		close: '\u001b[0m'
	},
	bold: {
		open: '\u001b[1m',
		close: '\u001b[22m'
	},
	dim: {
		open: '\u001b[2m',
		close: '\u001b[22m'
	},
	italic: {
		open: '\u001b[3m',
		close: '\u001b[23m'
	},
	underline: {
		open: '\u001b[4m',
		close: '\u001b[24m'
	},
	inverse: {
		open: '\u001b[7m',
		close: '\u001b[27m'
	},
	hidden: {
		open: '\u001b[8m',
		close: '\u001b[28m'
	},
	strikethrough: {
		open: '\u001b[9m',
		close: '\u001b[29m'
	},
	black: {
		open: '\u001b[30m',
		close: '\u001b[39m'
	},
	red: {
		open: '\u001b[31m',
		close: '\u001b[39m'
	},
	green: {
		open: '\u001b[32m',
		close: '\u001b[39m'
	},
	yellow: {
		open: '\u001b[33m',
		close: '\u001b[39m'
	},
	blue: {
		open: '\u001b[34m',
		close: '\u001b[39m'
	},
	magenta: {
		open: '\u001b[35m',
		close: '\u001b[39m'
	},
	cyan: {
		open: '\u001b[36m',
		close: '\u001b[39m'
	},
	white: {
		open: '\u001b[37m',
		close: '\u001b[39m'
	},
	gray: {
		open: '\u001b[90m',
		close: '\u001b[39m'
	},
	grey: {
		open: '\u001b[90m',
		close: '\u001b[39m'
	},
	bgBlack: {
		open: '\u001b[40m',
		close: '\u001b[49m'
	},
	bgRed: {
		open: '\u001b[41m',
		close: '\u001b[49m'
	},
	bgGreen: {
		open: '\u001b[42m',
		close: '\u001b[49m'
	},
	bgYellow: {
		open: '\u001b[43m',
		close: '\u001b[49m'
	},
	bgBlue: {
		open: '\u001b[44m',
		close: '\u001b[49m'
	},
	bgMagenta: {
		open: '\u001b[45m',
		close: '\u001b[49m'
	},
	bgCyan: {
		open: '\u001b[46m',
		close: '\u001b[49m'
	},
	bgWhite: {
		open: '\u001b[47m',
		close: '\u001b[49m'
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.