Socket
Socket
Sign inDemoInstall

ansi-colors

Package Overview
Dependencies
0
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.1 to 4.1.2

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;
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc