import * as proc from "https://deno.land/x/proc@0.21.1/src/deps/colors.ts";
String formatters and utilities for dealing with ANSI color codes.
This module is browser compatible.
This module supports NO_COLOR
environmental variable disabling any coloring
if NO_COLOR
is set.
Examples
Example 1
Example 1
import {
bgBlue,
bgRgb24,
bgRgb8,
bold,
italic,
red,
rgb24,
rgb8,
} from "https://deno.land/std@0.224.0/fmt/colors.ts";
console.log(bgBlue(italic(red(bold("Hello, World!")))));
// also supports 8bit colors
console.log(rgb8("Hello, World!", 42));
console.log(bgRgb8("Hello, World!", 42));
// and 24bit rgb
console.log(rgb24("Hello, World!", {
r: 41,
g: 42,
b: 43,
}));
console.log(bgRgb24("Hello, World!", {
r: 41,
g: 42,
b: 43,
}));
Functions
Set background color to black. | |
Set background color to blue. | |
Set background color to bright black. | |
Set background color to bright blue. | |
Set background color to bright cyan. | |
Set background color to bright green. | |
Set background color to bright magenta. | |
Set background color to bright red. | |
Set background color to bright white. | |
Set background color to bright yellow. | |
Set background color to cyan. | |
Set background color to green. | |
Set background color to magenta. | |
Set background color to red. | |
Set background color using 24bit rgb.
| |
Set background color using paletted 8bit colors. https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit | |
Set background color to white. | |
Set background color to yellow. | |
Set text color to black. | |
f blue | Set text color to blue. |
f bold | Make the text bold. |
Set text color to bright black. | |
Set text color to bright blue. | |
Set text color to bright cyan. | |
Set text color to bright green. | |
Set text color to bright magenta. | |
Set text color to bright red. | |
Set text color to bright white. | |
Set text color to bright yellow. | |
f cyan | Set text color to cyan. |
f dim | The text emits only a small amount of light. |
Get whether text color change is enabled or disabled. | |
f gray | Set text color to gray. |
Set text color to green. | |
Make the text hidden. | |
Invert background color and text color. | |
Make the text italic. | |
Set text color to magenta. | |
f red | Set text color to red. |
Reset the text modified | |
Set text color using 24bit rgb.
| |
f rgb8 | Set text color using paletted 8bit colors. https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit |
Set changing text color to enabled or disabled | |
Put horizontal line through the center of the text. | |
Remove ANSI escape codes from the string. | |
Make the text underline. | |
Set text color to white. | |
Set text color to yellow. |