ansi-styles
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -1,2 +0,2 @@ | ||
export interface CSPair { | ||
export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention | ||
/** | ||
@@ -3,0 +3,0 @@ The ANSI terminal control sequence for starting this style. |
47
index.js
@@ -22,3 +22,3 @@ const ANSI_BACKGROUND_OFFSET = 10; | ||
hidden: [8, 28], | ||
strikethrough: [9, 29] | ||
strikethrough: [9, 29], | ||
}, | ||
@@ -43,3 +43,3 @@ color: { | ||
cyanBright: [96, 39], | ||
whiteBright: [97, 39] | ||
whiteBright: [97, 39], | ||
}, | ||
@@ -64,4 +64,4 @@ bgColor: { | ||
bgCyanBright: [106, 49], | ||
bgWhiteBright: [107, 49] | ||
} | ||
bgWhiteBright: [107, 49], | ||
}, | ||
}; | ||
@@ -79,3 +79,3 @@ | ||
open: `\u001B[${style[0]}m`, | ||
close: `\u001B[${style[1]}m` | ||
close: `\u001B[${style[1]}m`, | ||
}; | ||
@@ -90,3 +90,3 @@ | ||
value: group, | ||
enumerable: false | ||
enumerable: false, | ||
}); | ||
@@ -97,3 +97,3 @@ } | ||
value: codes, | ||
enumerable: false | ||
enumerable: false, | ||
}); | ||
@@ -129,12 +129,12 @@ | ||
return 16 + | ||
(36 * Math.round(red / 255 * 5)) + | ||
(6 * Math.round(green / 255 * 5)) + | ||
Math.round(blue / 255 * 5); | ||
return 16 | ||
+ (36 * Math.round(red / 255 * 5)) | ||
+ (6 * Math.round(green / 255 * 5)) | ||
+ Math.round(blue / 255 * 5); | ||
}, | ||
enumerable: false | ||
enumerable: false, | ||
}, | ||
hexToRgb: { | ||
value: hex => { | ||
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); | ||
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); | ||
if (!matches) { | ||
@@ -144,6 +144,6 @@ return [0, 0, 0]; | ||
let {colorString} = matches.groups; | ||
let [colorString] = matches; | ||
if (colorString.length === 3) { | ||
colorString = colorString.split('').map(character => character + character).join(''); | ||
colorString = [...colorString].map(character => character + character).join(''); | ||
} | ||
@@ -154,12 +154,14 @@ | ||
return [ | ||
/* eslint-disable no-bitwise */ | ||
(integer >> 16) & 0xFF, | ||
(integer >> 8) & 0xFF, | ||
integer & 0xFF | ||
integer & 0xFF, | ||
/* eslint-enable no-bitwise */ | ||
]; | ||
}, | ||
enumerable: false | ||
enumerable: false, | ||
}, | ||
hexToAnsi256: { | ||
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), | ||
enumerable: false | ||
enumerable: false, | ||
}, | ||
@@ -200,2 +202,3 @@ ansi256ToAnsi: { | ||
// eslint-disable-next-line no-bitwise | ||
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); | ||
@@ -209,12 +212,12 @@ | ||
}, | ||
enumerable: false | ||
enumerable: false, | ||
}, | ||
rgbToAnsi: { | ||
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), | ||
enumerable: false | ||
enumerable: false, | ||
}, | ||
hexToAnsi: { | ||
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), | ||
enumerable: false | ||
} | ||
enumerable: false, | ||
}, | ||
}); | ||
@@ -221,0 +224,0 @@ |
{ | ||
"name": "ansi-styles", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "ANSI escape codes for styling strings in the terminal", | ||
@@ -51,5 +51,5 @@ "license": "MIT", | ||
"svg-term-cli": "^2.1.1", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
"tsd": "^0.19.0", | ||
"xo": "^0.47.0" | ||
} | ||
} |
@@ -7,9 +7,9 @@ # ansi-styles | ||
<img src="screenshot.svg" width="900"> | ||
![](screenshot.png) | ||
## Install | ||
```sh | ||
npm install ansi-styles | ||
``` | ||
$ npm install ansi-styles | ||
``` | ||
@@ -16,0 +16,0 @@ ## Usage |
15679
337