Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-styles

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-styles - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

57

ansi-styles.js
'use strict';
module.exports = {
reset: ['\x1b[0m', '\x1b[0m'],
var styles = module.exports;
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'],
var codes = {
reset: [0, 0],
black: ['\x1b[30m', '\x1b[39m'],
red: ['\x1b[31m', '\x1b[39m'],
green: ['\x1b[32m', '\x1b[39m'],
yellow: ['\x1b[33m', '\x1b[39m'],
blue: ['\x1b[34m', '\x1b[39m'],
magenta: ['\x1b[35m', '\x1b[39m'],
cyan: ['\x1b[36m', '\x1b[39m'],
white: ['\x1b[37m', '\x1b[39m'],
gray: ['\x1B[90m', '\x1b[39m'],
bold: [1, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
strikethrough: [9, 29],
bgBlack: ['\x1b[40m', '\x1b[49m'],
bgRed: ['\x1b[41m', '\x1b[49m'],
bgGreen: ['\x1b[42m', '\x1b[49m'],
bgYellow: ['\x1b[43m', '\x1b[49m'],
bgBlue: ['\x1b[44m', '\x1b[49m'],
bgMagenta: ['\x1b[45m', '\x1b[49m'],
bgCyan: ['\x1b[46m', '\x1b[49m'],
bgWhite: ['\x1b[47m', '\x1b[49m']
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],
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
};
Object.keys(codes).forEach(function (key) {
var val = codes[key];
var style = styles[key] = {};
style.open = '\x1b[' + val[0] + 'm';
style.close = '\x1b[' + val[1] + 'm';
});
{
"name": "ansi-styles",
"version": "0.2.0",
"version": "1.0.0",
"description": "ANSI escape codes for colorizing strings in the terminal",

@@ -5,0 +5,0 @@ "keywords": [

# ansi-styles [![Build Status](https://secure.travis-ci.org/sindresorhus/ansi-styles.png?branch=master)](http://travis-ci.org/sindresorhus/ansi-styles)
> ANSI escape codes for colorizing strings in the terminal.
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for colorizing strings in the terminal.

@@ -20,3 +20,3 @@ You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.

console.log(ansi.green[0] + 'Hello world!' + ansi.green[1]);
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
```

@@ -26,3 +26,3 @@

Each style is an array of a start and end escape code.
Each style has an `open` and `close` property.

@@ -67,2 +67,2 @@

MIT License • © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc