2026.0.0 • Published 5 months ago
@f0c1s/random-colored-string v2026.0.0
random-colored-string
Random colored string in terminal
Features
colored(str)
: Returns the input string in a random color (both regular and soft variants)allColored(str)
: Returns an array of the input string in all available colors- Regular colors: black, blue, cyan, green, magenta, red, white, yellow
- Soft colors: blackSoft, blueSoft, cyanSoft, greenSoft, magentaSoft, redSoft, whiteSoft, yellowSoft
Related projects
Name | NPM package | GitHub repo |
---|---|---|
color-black | npm | github |
color-blue | npm | github |
color-cyan | npm | github |
color-green | npm | github |
color-magenta | npm | github |
color-red | npm | github |
color-white | npm | github |
color-yellow | npm | github |
random-colored-string | npm | github |
Usage
import colored, { allColored } from "random-colored-string";
// Get string in a random color
console.log(colored("Hello, World!"));
// Get string in all available colors
console.log(allColored("Hello, World!"));
// Use specific colors
import { red, redSoft } from "random-colored-string";
console.log(red("Error!"));
console.log(redSoft("Warning..."));
References
- SVG IMG xterm256 colors wikimedia
- No I am not missing
!
. I don't want to show image here.
- No I am not missing
- https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
- https://learn.microsoft.com/en-us/windows/terminal/customize-settings/color-schemes
- https://superuser.com/questions/67582/tty-with-256-colors
- https://unix.stackexchange.com/questions/118806/tmux-term-and-256-colours-support
- https://unix.stackexchange.com/questions/148/colorizing-your-terminal-and-shell-environment
- https://unix.stackexchange.com/questions/23763/checking-how-many-colors-my-terminal-emulator-supports/23789#23789
License
MIT License
Copyright (c) 2019-2025 Anubhav Saini