1
0
mirror of https://github.com/garraflavatra/trmclr.git synced 2024-11-21 21:38:57 +01:00
Terminal colors, but easier.
Go to file
2024-08-09 15:24:30 +02:00
.github/workflows Update lint script and action 2024-08-09 15:19:48 +02:00
.gitignore Initial commit 2022-10-09 10:10:43 +02:00
index.mjs Big refactor 2024-08-09 15:17:30 +02:00
LICENSE.md Update readme.md 2024-08-09 13:36:32 +02:00
package-lock.json v1.1.0 2024-08-09 15:17:52 +02:00
package.json Update lint script and action 2024-08-09 15:19:48 +02:00
README.md Add npm badge to readme 2024-08-09 15:24:30 +02:00
tsconfig.json Big refactor 2024-08-09 15:17:30 +02:00

trmclr

NPM Version

Easy terminal colors for browsers, Node.js, Deno, Bun, and probably some other environments.

  • Comes with 45 colors and helpers.
  • Respects NO_COLOR.
  • No dependencies.
  • Tree-shakeable.

Colors and helpers

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

Usage

import { cyan, bgMagenta } from 'trmclr';

console.log(cyan(bgMagenta('Some text')));

Enable or disable color

import { getColorEnabled, setColorEnabled } from 'trmclr';

setColorEnabled(true);
setColorEnabled(false);

getColorEnabled(); // → false

Remove colors and decorations

import { cyan, stripColor } from 'trmclr';

stripColor(cyan('Hi')); // → uncolored "Hi"

License

(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.

Smart Yellow