Comparing version 3.0.2 to 3.0.3
140
index.d.ts
type ColorExtend = Record<string, string | { open: string, close: string }> | ||
declare const ansis: Ansis; | ||
interface Ansis { | ||
/** | ||
* Return styled string. | ||
* | ||
* @param {string | TemplateStringsArray} string | ||
*/ | ||
(string: string): string; | ||
(string: TemplateStringsArray, ...parameters: string[]): string; | ||
/** | ||
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color. | ||
* | ||
* Code ranges: | ||
* ``` | ||
* 0 - 7: standard colors | ||
* 8 - 15: high intensity colors | ||
* 16 - 231: 6 × 6 × 6 cube (216 colors) | ||
* 232 - 255: grayscale from black to white in 24 steps | ||
* ``` | ||
* | ||
* @param {number} code in range [0, 255]. | ||
*/ | ||
ansi256: (code: number) => this; | ||
/** | ||
* Alias for ansi256. | ||
* | ||
* @param {number} code in range [0, 255]. | ||
*/ | ||
fg: (code: number) => this; | ||
/** | ||
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color. | ||
* | ||
* Code ranges: | ||
* ``` | ||
* 0 - 7: standard colors | ||
* 8 - 15: high intensity colors | ||
* 16 - 231: 6 × 6 × 6 cube (216 colors) | ||
* 232 - 255: grayscale from black to white in 24 steps | ||
* ``` | ||
* | ||
* @param {number} code in range [0, 255]. | ||
*/ | ||
bgAnsi256: (code: number) => this; | ||
/** | ||
* Alias for bgAnsi256. | ||
* | ||
* @param {number} code in range [0, 255]. | ||
*/ | ||
bg: (code: number) => this; | ||
/** | ||
* Set RGB values for foreground color. | ||
* | ||
* @param {number} red The red value, in range [0, 255]. | ||
* @param {number} green The green value, in range [0, 255]. | ||
* @param {number} blue The blue value, in range [0, 255]. | ||
*/ | ||
rgb: (red: number, green: number, blue: number) => this; | ||
/** | ||
* Set HEX value for foreground color. | ||
* | ||
* @param {string} hex | ||
*/ | ||
hex: (color: string) => this; | ||
/** | ||
* Set RGB values for background color. | ||
* | ||
* @param {number} red The red value, in range [0, 255]. | ||
* @param {number} green The green value, in range [0, 255]. | ||
* @param {number} blue The blue value, in range [0, 255]. | ||
*/ | ||
bgRgb: (red: number, green: number, blue: number) => this; | ||
/** | ||
* Set HEX value for background color. | ||
* | ||
* @param {string} hex | ||
*/ | ||
bgHex: (color: string) => this; | ||
/** | ||
* Remove ANSI styling codes. | ||
* | ||
* @param {string} str | ||
* @return {string} | ||
*/ | ||
strip: (string: string) => string; | ||
/** | ||
* Extend base colors with custom ones. | ||
* | ||
* @param {Object.<name:string, value:string|{open:string, close:string}>} colors The object with key as color name | ||
* and value as hex code of custom color or the object with 'open' and 'close' codes. | ||
*/ | ||
extend: (colors: ColorExtend) => void; | ||
/** The ANSI escape sequences for starting the current style. */ | ||
readonly open: string; | ||
/** The ANSI escape sequences for ending the current style. */ | ||
readonly close: string; | ||
/** Reset the current style. */ | ||
readonly reset: this; | ||
/** Invert background and foreground colors. */ | ||
readonly inverse: this; | ||
/** Print the invisible text. */ | ||
readonly hidden: this; | ||
/** Print visible text without ANSI styling. */ | ||
readonly visible: this; | ||
/** <b>Bold</b> style (high intensity). */ | ||
readonly bold: this; | ||
/** Faint style (low intensity or dim). */ | ||
readonly dim: this; | ||
/** <i>Italic</i> style. (Not widely supported) */ | ||
readonly italic: this; | ||
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */ | ||
readonly underline: this; | ||
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */ | ||
readonly strikethrough: this; | ||
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */ | ||
readonly strike: this; | ||
readonly black: this; | ||
@@ -181,6 +66,2 @@ readonly red: this; | ||
declare const Ansis: new () => Ansis; | ||
/** | ||
* Base ANSI Styles | ||
*/ | ||
type AnsiStyles = ( | ||
@@ -198,6 +79,2 @@ | 'reset' | ||
); | ||
/** | ||
* Base ANSI Colors | ||
*/ | ||
type AnsiColors = ( | ||
@@ -241,24 +118,13 @@ | 'black' | ||
); | ||
type StringUnion<T, B extends string> = T | (B & Record<never, never>); | ||
type AnsiColorsExtend<T extends string> = StringUnion<AnsiColors, T>; | ||
declare function ansi256(code: number): Ansis; | ||
declare function fg(code: number): Ansis; | ||
declare function bgAnsi256(code: number): Ansis; | ||
declare function bg(code: number): Ansis; | ||
declare function rgb(red: number, green: number, blue: number): Ansis; | ||
declare function bgRgb(red: number, green: number, blue: number): Ansis; | ||
declare function hex(code: string): Ansis; | ||
declare function bgHex(code: string): Ansis; | ||
// misc | ||
declare const reset: Ansis; | ||
@@ -268,4 +134,2 @@ declare const inverse: Ansis; | ||
declare const visible: Ansis; | ||
// styles | ||
declare const bold: Ansis; | ||
@@ -277,4 +141,2 @@ declare const dim: Ansis; | ||
declare const strike: Ansis; | ||
// foreground colors | ||
declare const black: Ansis; | ||
@@ -298,4 +160,2 @@ declare const red: Ansis; | ||
declare const whiteBright: Ansis; | ||
// background colors | ||
declare const bgBlack: Ansis; | ||
@@ -302,0 +162,0 @@ declare const bgRed: Ansis; |
{ | ||
"name": "ansis", | ||
"version": "3.0.2", | ||
"description": "Colorize text in terminal and console output with ANSI colors & styles", | ||
"version": "3.0.3", | ||
"description": "Colorize terminal with ANSI colors & styles", | ||
"keywords": [ | ||
"ansi", | ||
"colour", | ||
"color", | ||
"colors", | ||
"styles", | ||
"truecolor", | ||
"ansi256", | ||
"terminal", | ||
"xterm", | ||
"console", | ||
"cli", | ||
"log", | ||
"logging", | ||
"strip-color", | ||
"truecolor", | ||
"rgb", | ||
"red", | ||
"green", | ||
"yellow", | ||
"blue", | ||
"magenta", | ||
"cyan", | ||
"FORCE_COLOR", | ||
"NO_COLOR", | ||
"ansi-colors", | ||
"chalk", | ||
"colorette", | ||
"colors.js", | ||
"kleur", | ||
"picocolors" | ||
"chalk" | ||
], | ||
"license": "ISC", | ||
"author": "webdiscus (https://github.com/webdiscus)", | ||
"maintainers": [ | ||
"webdiscus (https://github.com/webdiscus)" | ||
], | ||
"funding": { | ||
"type": "patreon", | ||
"url": "https://patreon.com/biodiscus" | ||
}, | ||
"author": "webdiscus", | ||
"homepage": "https://github.com/webdiscus/ansis", | ||
"bugs": { | ||
"url": "https://github.com/webdiscus/ansis/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/webdiscus/ansis.git" | ||
}, | ||
"repository": "webdiscus/ansis", | ||
"sideEffects": false, | ||
@@ -77,4 +43,3 @@ "main": "./index.js", | ||
"README.md" | ||
], | ||
"dependencies": {} | ||
] | ||
} |
@@ -1,10 +0,9 @@ | ||
<div align="center"> | ||
<h1 align="center"> | ||
<a href="https://github.com/webdiscus/ansis"> | ||
<img width="323" src="docs/img/ansis-logo.png" alt="ansis"><br> | ||
ANSI Styling | ||
</a> | ||
</h1> | ||
</div> | ||
<p align="center"> | ||
<a href="https://github.com/webdiscus/ansis"> | ||
<img width="323" src="docs/img/ansis-logo.png" alt="ansis"><br> | ||
ANSI Styling | ||
</a> | ||
</p> | ||
--- | ||
[![node](https://img.shields.io/node/v/ansis)](https://nodejs.org) | ||
@@ -15,3 +14,3 @@ [![Test](https://github.com/webdiscus/ansis/actions/workflows/test.yml/badge.svg)](https://github.com/webdiscus/ansis/actions/workflows/test.yml) | ||
The Node.js library to colorize terminal with ANSI colors & styles, **smaller** and **faster** alternative to [Chalk][chalk]. | ||
The Node.js library to colorize terminal with ANSI colors & styles, **smaller** and **faster** alternative to [Chalk](https://github.com/chalk/chalk). | ||
@@ -32,3 +31,3 @@ #### Usage example | ||
🚀 [Install and Quick Start](https://github.com/webdiscus/ansis#install)\ | ||
📖 [Read full docs on GitHub][ansis] | ||
📖 [Read full docs on GitHub](https://github.com/webdiscus/ansis) | ||
@@ -38,3 +37,3 @@ ## 🏆 Compare & Benchmark | ||
See the [features comparison](https://github.com/webdiscus/ansis#compare) and [benchmarks](https://github.com/webdiscus/ansis#benchmark) of most popular terminal colors libraries:\ | ||
[ansis][ansis], [chalk][chalk], [kleur][kleur], [kolorist][kolorist], [colors.js][colors.js], [colorette][colorette], [picocolors][picocolors], [ansi-colors][ansi-colors], [cli-color][cli-color], [colors-cli][colors-cli]. | ||
`ansis` `chalk` `kleur` `kolorist` `colors.js` `colorette` `picocolors` `ansi-colors` `cli-color` `colors-cli`. | ||
@@ -56,3 +55,3 @@ ## 💡 Highlights | ||
- [TrueColor](https://github.com/webdiscus/ansis#truecolor) (**RGB**, **HEX**) ``` rgb(224, 17, 95)`Ruby` ```, ``` hex('#96C')`Amethyst` ``` | ||
- [Fallback](https://github.com/webdiscus/ansis#fallback) to supported [color space](https://github.com/webdiscus/ansis#color-support): TrueColor —> 256 colors —> 16 colors —> no | ||
- [Fallback](https://github.com/webdiscus/ansis#fallback) to supported color space: TrueColor —> 256 colors —> 16 colors —> no | ||
colors | ||
@@ -69,21 +68,1 @@ - [ANSI codes](https://github.com/webdiscus/ansis#escape-codes) as `open` and `close` properties ``` `Hello ${red.open}World${red.close}!` ``` | ||
[ISC](https://github.com/webdiscus/ansis/blob/master/LICENSE) | ||
[colors.js]: https://github.com/Marak/colors.js | ||
[colorette]: https://github.com/jorgebucaran/colorette | ||
[picocolors]: https://github.com/alexeyraspopov/picocolors | ||
[cli-color]: https://github.com/medikoo/cli-color | ||
[colors-cli]: https://github.com/jaywcjlove/colors-cli | ||
[ansi-colors]: https://github.com/doowb/ansi-colors | ||
[kleur]: https://github.com/lukeed/kleur | ||
[kolorist]: https://github.com/marvinhagemeister/kolorist | ||
[chalk]: https://github.com/chalk/chalk | ||
[ansis]: https://github.com/webdiscus/ansis |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14758
186
1
64
1