ansi-colors
Advanced tools
Comparing version
12
index.js
'use strict'; | ||
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); | ||
const identity = val => val; | ||
@@ -11,8 +10,9 @@ /* eslint-disable no-control-regex */ | ||
const create = () => { | ||
const colors = { enabled: true, visible: true, styles: {}, keys: {} }; | ||
const colors = { | ||
enabled: process.env.FORCE_COLOR !== '0', | ||
visible: true, | ||
styles: {}, | ||
keys: {} | ||
}; | ||
if ('FORCE_COLOR' in process.env) { | ||
colors.enabled = process.env.FORCE_COLOR !== '0'; | ||
} | ||
const ansi = style => { | ||
@@ -19,0 +19,0 @@ let open = style.open = `\u001b[${style.codes[0]}m`; |
{ | ||
"name": "ansi-colors", | ||
"description": "Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"homepage": "https://github.com/doowb/ansi-colors", | ||
@@ -39,2 +39,3 @@ "author": "Brian Woodward (https://github.com/doowb)", | ||
"keywords": [ | ||
"256", | ||
"ansi", | ||
@@ -60,6 +61,13 @@ "bgblack", | ||
"bold", | ||
"cli", | ||
"clorox", | ||
"color", | ||
"colors", | ||
"colour", | ||
"command line", | ||
"command-line", | ||
"console", | ||
"cyan", | ||
"dim", | ||
"formatting", | ||
"gray", | ||
@@ -72,8 +80,20 @@ "green", | ||
"kleur", | ||
"log", | ||
"logging", | ||
"magenta", | ||
"red", | ||
"reset", | ||
"rgb", | ||
"shell", | ||
"str", | ||
"strikethrough", | ||
"string", | ||
"style", | ||
"styles", | ||
"terminal", | ||
"text", | ||
"tty", | ||
"underline", | ||
"white", | ||
"xterm", | ||
"yellow" | ||
@@ -80,0 +100,0 @@ ], |
@@ -29,2 +29,3 @@ 'use strict'; | ||
plusMinus: 'Β±', | ||
question: '?', | ||
section: 'Β§', | ||
@@ -42,3 +43,2 @@ starsOff: 'β', | ||
info: 'i', | ||
question: '?', | ||
questionSmall: '?', | ||
@@ -59,3 +59,2 @@ pointer: '>', | ||
info: 'βΉ', | ||
question: '?', | ||
questionFull: 'οΌ', | ||
@@ -62,0 +61,0 @@ questionSmall: 'οΉ', |
@@ -7,10 +7,77 @@ // Imported from DefinitelyTyped project. | ||
interface SymbolsType { | ||
check: string; | ||
cross: string; | ||
info: string; | ||
line: string; | ||
pointer: string; | ||
pointerSmall: string; | ||
question: string; | ||
warning: string; | ||
/** | ||
* `undefined` on windows, `β` on other platforms. | ||
*/ | ||
ballotCross?: "β"; | ||
ballotDisabled: "β"; | ||
ballotOff: "β"; | ||
ballotOn: "β"; | ||
bullet: "β’"; | ||
bulletWhite: "β¦"; | ||
/** | ||
* `β` on windows, `β` on other platforms. | ||
*/ | ||
check: "β" | "β"; | ||
/** | ||
* `Γ` on windows, `β` on other platforms. | ||
*/ | ||
cross: "Γ" | "β"; | ||
/** | ||
* `...` on windows, `β―` on other platforms. | ||
*/ | ||
ellipsisLarge: "..." | "β―"; | ||
/** | ||
* `...` on windows, `β¦` on other platforms. | ||
*/ | ||
ellipsis: "..." | "β¦"; | ||
fullBlock: "β"; | ||
heart: "β€"; | ||
identicalTo: "β‘"; | ||
info: "i" | "βΉ"; | ||
line: "β"; | ||
mark: "β»"; | ||
middot: "Β·"; | ||
minus: "οΌ"; | ||
multiplication: "Γ"; | ||
obelus: "Γ·"; | ||
pencilDownRight: "β"; | ||
pencilRight: "β"; | ||
pencilUpRight: "β"; | ||
percent: "%"; | ||
pilcrow2: "β‘"; | ||
pilcrow: "ΒΆ"; | ||
plusMinus: "Β±"; | ||
/** | ||
* `>` on windows, `βΈ` on linux, and `β―` on other platforms. | ||
*/ | ||
pointer: ">" | "βΈ" | "β―"; | ||
/** | ||
* `Β»` on windows, `β£` on linux, and `βΊ` on other platforms. | ||
*/ | ||
pointerSmall: "Β»" | "β£" | "βΊ"; | ||
question: "?"; | ||
/** | ||
* `undefined` on windows, `οΌ` on other platforms. | ||
*/ | ||
questionFull?: "οΌ"; | ||
/** | ||
* `?` on windows, `οΉ` on other platforms. | ||
*/ | ||
questionSmall: "?" | "οΉ"; | ||
/** | ||
* `( )` on windows, `β―` on other platforms. | ||
*/ | ||
radioOff: "( )" | "β―"; | ||
/** | ||
* `(*)` on windows, `β` on other platforms. | ||
*/ | ||
radioOn: "(*)" | "β"; | ||
section: "Β§"; | ||
starsOff: "β"; | ||
starsOn: "β "; | ||
upDownArrow: "β"; | ||
/** | ||
* `βΌ` on windows, `β ` on other platforms. | ||
*/ | ||
warning: "βΌ" | "β "; | ||
} | ||
@@ -27,5 +94,2 @@ | ||
export interface StyleFunction extends StylesType<StyleFunction> { | ||
(s: string): string; | ||
} | ||
@@ -86,79 +150,89 @@ interface StylesType<T> { | ||
// modifiers | ||
export const reset: StyleFunction; | ||
export const bold: StyleFunction; | ||
export const dim: StyleFunction; | ||
export const italic: StyleFunction; | ||
export const underline: StyleFunction; | ||
export const inverse: StyleFunction; | ||
export const hidden: StyleFunction; | ||
export const strikethrough: StyleFunction; | ||
declare namespace ansiColors { | ||
interface StyleFunction extends StylesType<StyleFunction> { | ||
(s: string): string; | ||
} | ||
// colors | ||
export const black: StyleFunction; | ||
export const red: StyleFunction; | ||
export const green: StyleFunction; | ||
export const yellow: StyleFunction; | ||
export const blue: StyleFunction; | ||
export const magenta: StyleFunction; | ||
export const cyan: StyleFunction; | ||
export const white: StyleFunction; | ||
export const gray: StyleFunction; | ||
export const grey: StyleFunction; | ||
// modifiers | ||
const reset: StyleFunction; | ||
const bold: StyleFunction; | ||
const dim: StyleFunction; | ||
const italic: StyleFunction; | ||
const underline: StyleFunction; | ||
const inverse: StyleFunction; | ||
const hidden: StyleFunction; | ||
const strikethrough: StyleFunction; | ||
// bright colors | ||
export const blackBright: StyleFunction; | ||
export const redBright: StyleFunction; | ||
export const greenBright: StyleFunction; | ||
export const yellowBright: StyleFunction; | ||
export const blueBright: StyleFunction; | ||
export const magentaBright: StyleFunction; | ||
export const cyanBright: StyleFunction; | ||
export const whiteBright: StyleFunction; | ||
// colors | ||
const black: StyleFunction; | ||
const red: StyleFunction; | ||
const green: StyleFunction; | ||
const yellow: StyleFunction; | ||
const blue: StyleFunction; | ||
const magenta: StyleFunction; | ||
const cyan: StyleFunction; | ||
const white: StyleFunction; | ||
const gray: StyleFunction; | ||
const grey: StyleFunction; | ||
// background colors | ||
export const bgBlack: StyleFunction; | ||
export const bgRed: StyleFunction; | ||
export const bgGreen: StyleFunction; | ||
export const bgYellow: StyleFunction; | ||
export const bgBlue: StyleFunction; | ||
export const bgMagenta: StyleFunction; | ||
export const bgCyan: StyleFunction; | ||
export const bgWhite: StyleFunction; | ||
// bright colors | ||
const blackBright: StyleFunction; | ||
const redBright: StyleFunction; | ||
const greenBright: StyleFunction; | ||
const yellowBright: StyleFunction; | ||
const blueBright: StyleFunction; | ||
const magentaBright: StyleFunction; | ||
const cyanBright: StyleFunction; | ||
const whiteBright: StyleFunction; | ||
// bright background colors | ||
export const bgBlackBright: StyleFunction; | ||
export const bgRedBright: StyleFunction; | ||
export const bgGreenBright: StyleFunction; | ||
export const bgYellowBright: StyleFunction; | ||
export const bgBlueBright: StyleFunction; | ||
export const bgMagentaBright: StyleFunction; | ||
export const bgCyanBright: StyleFunction; | ||
export const bgWhiteBright: StyleFunction; | ||
// background colors | ||
const bgBlack: StyleFunction; | ||
const bgRed: StyleFunction; | ||
const bgGreen: StyleFunction; | ||
const bgYellow: StyleFunction; | ||
const bgBlue: StyleFunction; | ||
const bgMagenta: StyleFunction; | ||
const bgCyan: StyleFunction; | ||
const bgWhite: StyleFunction; | ||
export let enabled: boolean; | ||
export let visible: boolean; | ||
export const ansiRegex: RegExp; | ||
// bright background colors | ||
const bgBlackBright: StyleFunction; | ||
const bgRedBright: StyleFunction; | ||
const bgGreenBright: StyleFunction; | ||
const bgYellowBright: StyleFunction; | ||
const bgBlueBright: StyleFunction; | ||
const bgMagentaBright: StyleFunction; | ||
const bgCyanBright: StyleFunction; | ||
const bgWhiteBright: StyleFunction; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
export function stripColor(s: string): string; | ||
let enabled: boolean; | ||
let visible: boolean; | ||
const ansiRegex: RegExp; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
export function strip(s: string): string; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
function stripColor(s: string): string; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
export function unstyle(s: string): string; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
function strip(s: string): string; | ||
export const styles: StylesType<StyleType>; | ||
export const symbols: SymbolsType; | ||
/** | ||
* Remove styles from string | ||
*/ | ||
function unstyle(s: string): string; | ||
/** | ||
* Outputs a string with check-symbol as prefix | ||
*/ | ||
export function ok(...args: string[]): string; | ||
const styles: StylesType<StyleType>; | ||
const symbols: SymbolsType; | ||
/** | ||
* Outputs a string with check-symbol as prefix | ||
*/ | ||
function ok(...args: string[]): string; | ||
function create(): typeof ansiColors; | ||
} | ||
export = ansiColors; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
25929
6.29%430
19.78%2
-33.33%