Easy terminal colors.
- Supports browsers, Node.js, Deno, Bun, and probably some other environments.
- Comes with 45 colors and helpers.
- Respects
NO_COLOR
. - No dependencies.
- Tree-shakeable.
bgBlack, bgBlue, bgBrightBlack, bgBrightBlue, bgBrightCyan, bgBrightGreen, bgBrightMagenta, bgBrightRed, bgBrightWhite, bgBrightYellow, bgCyan, bgGreen, bgMagenta, bgRed, bgRgb24, bgRgb8, bgWhite, bgYellow, black, blue, bold, brightBlack, brightBlue, brightCyan, brightGreen, brightMagenta, brightRed, brightWhite, brightYellow, cyan, dim, getColorEnabled, gray, green, hidden, inverse, italic, magenta, red, reset, strikethrough, stripColor, underline, white, yellow
import { cyan, bgMagenta } from 'trmclr';
console.log(cyan(bgMagenta('Some text')));
import { getColorEnabled, setColorEnabled } from 'trmclr';
setColorEnabled(true);
setColorEnabled(false);
getColorEnabled(); // → false
import { cyan, stripColor } from 'trmclr';
stripColor(cyan('Hi')); // → uncolored "Hi"
(c) 2022-2024 Romein van Buren. Licensed under the MIT license.
For the full copyright and license information, please see the LICENSE.md
file that was distributed with this source code.
Original implementation: (c) 2018-2022 the Deno authors.