diff --git a/picocolors.js b/picocolors.js index fdb6304..98c072f 100644 --- a/picocolors.js +++ b/picocolors.js @@ -35,6 +35,7 @@ let createColors = (enabled = isColorSupported) => ({ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String, hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String, strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String, + black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String, red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String, green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String, @@ -44,6 +45,7 @@ let createColors = (enabled = isColorSupported) => ({ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String, white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String, gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String, + bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String, bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String, bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String, @@ -52,6 +54,24 @@ let createColors = (enabled = isColorSupported) => ({ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String, bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String, bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String, + + blackBright: enabled ? formatter("\x1b[90m", "\x1b[39m"): String, + redBright: enabled ? formatter("\x1b[91m", "\x1b[39m"): String, + greenBright: enabled ? formatter("\x1b[92m", "\x1b[39m"): String, + yellowBright: enabled ? formatter("\x1b[93m", "\x1b[39m"): String, + blueBright: enabled ? formatter("\x1b[94m", "\x1b[39m"): String, + magentaBright: enabled ? formatter("\x1b[95m", "\x1b[39m"): String, + cyanBright: enabled ? formatter("\x1b[96m", "\x1b[39m"): String, + whiteBright: enabled ? formatter("\x1b[97m", "\x1b[39m"): String, + + bgBlackBright: enabled ? formatter("\x1b[100m","\x1b[49m"): String, + bgRedBright: enabled ? formatter("\x1b[101m","\x1b[49m"): String, + bgGreenBright: enabled ? formatter("\x1b[102m","\x1b[49m"): String, + bgYellowBright: enabled ? formatter("\x1b[103m","\x1b[49m"): String, + bgBlueBright: enabled ? formatter("\x1b[104m","\x1b[49m"): String, + bgMagentaBright: enabled ? formatter("\x1b[105m","\x1b[49m"): String, + bgCyanBright: enabled ? formatter("\x1b[106m","\x1b[49m"): String, + bgWhiteBright: enabled ? formatter("\x1b[107m","\x1b[49m"): String, }) module.exports = createColors() diff --git a/tests/test.js b/tests/test.js index 3bc7f58..04c99a7 100644 --- a/tests/test.js +++ b/tests/test.js @@ -10,6 +10,7 @@ const FMT = { inverse: ["\x1b[7m", "\x1b[27m"], hidden: ["\x1b[8m", "\x1b[28m"], strikethrough: ["\x1b[9m", "\x1b[29m"], + black: ["\x1b[30m", "\x1b[39m"], red: ["\x1b[31m", "\x1b[39m"], green: ["\x1b[32m", "\x1b[39m"], @@ -19,6 +20,7 @@ const FMT = { cyan: ["\x1b[36m", "\x1b[39m"], white: ["\x1b[37m", "\x1b[39m"], gray: ["\x1b[90m", "\x1b[39m"], + bgBlack: ["\x1b[40m", "\x1b[49m"], bgRed: ["\x1b[41m", "\x1b[49m"], bgGreen: ["\x1b[42m", "\x1b[49m"], @@ -27,6 +29,24 @@ const FMT = { bgMagenta: ["\x1b[45m", "\x1b[49m"], bgCyan: ["\x1b[46m", "\x1b[49m"], bgWhite: ["\x1b[47m", "\x1b[49m"], + + blackBright: ["\x1b[90m", "\x1b[39m"], + redBright: ["\x1b[91m", "\x1b[39m"], + greenBright: ["\x1b[92m", "\x1b[39m"], + yellowBright: ["\x1b[93m", "\x1b[39m"], + blueBright: ["\x1b[94m", "\x1b[39m"], + magentaBright: ["\x1b[95m", "\x1b[39m"], + cyanBright: ["\x1b[96m", "\x1b[39m"], + whiteBright: ["\x1b[97m", "\x1b[39m"], + + bgBlackBright: ["\x1b[100m","\x1b[49m"], + bgRedBright: ["\x1b[101m","\x1b[49m"], + bgGreenBright: ["\x1b[102m","\x1b[49m"], + bgYellowBright: ["\x1b[103m","\x1b[49m"], + bgBlueBright: ["\x1b[104m","\x1b[49m"], + bgMagentaBright: ["\x1b[105m","\x1b[49m"], + bgCyanBright: ["\x1b[106m","\x1b[49m"], + bgWhiteBright: ["\x1b[107m","\x1b[49m"], } test("color matching", () => { diff --git a/types.ts b/types.ts index b4bacee..ccc4d7f 100644 --- a/types.ts +++ b/types.ts @@ -10,6 +10,7 @@ export interface Colors { inverse: Formatter hidden: Formatter strikethrough: Formatter + black: Formatter red: Formatter green: Formatter @@ -19,6 +20,7 @@ export interface Colors { cyan: Formatter white: Formatter gray: Formatter + bgBlack: Formatter bgRed: Formatter bgGreen: Formatter @@ -27,4 +29,23 @@ export interface Colors { bgMagenta: Formatter bgCyan: Formatter bgWhite: Formatter + + blackBright: Formatter + redBright: Formatter + greenBright: Formatter + yellowBright: Formatter + blueBright: Formatter + magentaBright: Formatter + cyanBright: Formatter + whiteBright: Formatter + + bgBlackBright: Formatter + bgRedBright: Formatter + bgGreenBright: Formatter + bgYellowBright: Formatter + bgBlueBright: Formatter + bgMagentaBright: Formatter + bgCyanBright: Formatter + bgWhiteBright: Formatter + }