Socket
Socket
Sign inDemoInstall

ansi-styles

Package Overview
Dependencies
Maintainers
2
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 3.2.1 to 4.0.0

35

index.js
'use strict';
const colorConvert = require('color-convert');
const wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert, arguments);
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert, arguments);
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;

@@ -42,5 +42,5 @@ };

white: [37, 39],
gray: [90, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],

@@ -76,11 +76,10 @@ greenBright: [92, 39],

// Fix humans
styles.color.grey = styles.color.gray;
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const groupName of Object.keys(styles)) {
const group = styles[groupName];
for (const styleName of Object.keys(group)) {
const style = group[styleName];
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {

@@ -133,9 +132,7 @@ open: `\u001B[${style[0]}m`,

for (let key of Object.keys(colorConvert)) {
if (typeof colorConvert[key] !== 'object') {
for (let [key, suite] of Object.entries(colorConvert)) {
if (typeof suite !== 'object') {
continue;
}
const suite = colorConvert[key];
if (key === 'ansi16') {

@@ -142,0 +139,0 @@ key = 'ansi';

{
"name": "ansi-styles",
"version": "3.2.1",
"version": "4.0.0",
"description": "ANSI escape codes for styling strings in the terminal",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=8"
},

@@ -46,13 +46,9 @@ "scripts": {

"dependencies": {
"color-convert": "^1.9.0"
"color-convert": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"babel-polyfill": "^6.23.0",
"ava": "^1.4.1",
"svg-term-cli": "^2.1.1",
"xo": "*"
},
"ava": {
"require": "babel-polyfill"
"xo": "^0.24.0"
}
}

@@ -7,3 +7,3 @@ # ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)

<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
<img src="screenshot.svg" width="900">

@@ -64,3 +64,3 @@

- `white`
- `gray` ("bright black")
- `blackBright` (alias: `gray`, `grey`)
- `redBright`

@@ -84,3 +84,3 @@ - `greenBright`

- `bgWhite`
- `bgBlackBright`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgRedBright`

@@ -148,4 +148,12 @@ - `bgGreenBright`

## License
---
MIT
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
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