diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-11-26 00:32:16 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-12-07 00:31:07 +0100 |
commit | 832290a0d425aa027c279a4a96a70550a2fdfff2 (patch) | |
tree | 1979058b478e79f454e3bec754cd73e263636cfb /doc/api/util.md | |
parent | 2a0ec9c6459f50301a989a6df1b89358c3a9158c (diff) | |
download | node-new-832290a0d425aa027c279a4a96a70550a2fdfff2.tar.gz |
util: add more predefined color codes to inspect.colors
This adds most commonly used ANSI color codes to
`util.inspect.colors`.
PR-URL: https://github.com/nodejs/node/pull/30659
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Diffstat (limited to 'doc/api/util.md')
-rw-r--r-- | doc/api/util.md | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/doc/api/util.md b/doc/api/util.md index ac23f138ad..88e2f34b7c 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -678,13 +678,72 @@ The default styles and associated colors are: * `symbol`: `green` * `undefined`: `grey` -The predefined color codes are: `white`, `grey`, `black`, `blue`, `cyan`, -`green`, `magenta`, `red` and `yellow`. There are also `bold`, `italic`, -`underline` and `inverse` codes. - Color styling uses ANSI control codes that may not be supported on all terminals. To verify color support use [`tty.hasColors()`][]. +Predefined control codes are listed below (grouped as "Modifiers", "Foreground +colors", and "Background colors"). + +#### Modifiers + +Modifier support varies throughout different terminals. They will mostly be +ignored, if not supported. + +* `reset` - Resets all (color) modifiers to their defaults +* **bold** - Make text bold +* _italic_ - Make text italic +* <span style="border-bottom: 1px;">underline</span> - Make text underlined +* ~~strikethrough~~ - Puts a horizontal line through the center of the text + (Alias: `strikeThrough`, `crossedout`, `crossedOut`) +* `hidden` - Prints the text, but makes it invisible (Alias: conceal) +* <span style="opacity: 0.5;">dim</span> - Decreased color intensity (Alias: + `faint`) +* <span style="border-top: 1px">overlined</span> - Make text overlined +* blink - Hides and shows the text in an interval +* <span style="filter: invert(100%)">inverse</span> - Swap foreground and + background colors (Alias: `swapcolors`, `swapColors`) +* <span style="border-bottom: 1px double;">doubleunderline</span> - Make text + double underlined (Alias: `doubleUnderline`) +* <span style="border: 1px">framed</span> - Draw a frame around the text + +#### Foreground colors + +* `black` +* `red` +* `green` +* `yellow` +* `blue` +* `magenta` +* `cyan` +* `white` +* `gray` (alias: `grey`, `blackBright`) +* `redBright` +* `greenBright` +* `yellowBright` +* `blueBright` +* `magentaBright` +* `cyanBright` +* `whiteBright` + +#### Background colors + +* `bgBlack` +* `bgRed` +* `bgGreen` +* `bgYellow` +* `bgBlue` +* `bgMagenta` +* `bgCyan` +* `bgWhite` +* `bgGray` (alias: `bgGrey`, `bgBlackBright`) +* `bgRedBright` +* `bgGreenBright` +* `bgYellowBright` +* `bgBlueBright` +* `bgMagentaBright` +* `bgCyanBright` +* `bgWhiteBright` + ### Custom inspection functions on Objects <!-- type=misc --> |