Tiny bash utility for coloring terminal output and prompt
The motivating use case was easily stacking styles, which is not possible to do with other tools like node's chalk:
Useful for templating colorful prompts (use -e|--escape
for this):
PS1=$(clc -e '<bold:<red:[<yellow:\\u><green:@><blue:\\h><magenta:\\W>]>$ >')
bash <(curl -s https://raw.githubusercontent.com/betafcc/clc/master/clc) '<red:hello <reverse:world>'
curl -s https://raw.githubusercontent.com/betafcc/clc/master/clc | sudo tee /usr/local/bin/clc > /dev/null && sudo chmod +x /usr/local/bin/clc
Then use:
clc '<red:hello <reverse:world>'
clc '<red:hello>'
clc '<green:hello <blue: world>>'
clc '<rgb 255 120 120: hello>'
clc '<bg red:hello>'
clc '<bg green:hello <bg blue: world>>'
clc '<bg rgb 255 120 120: hello>'
clc '<bold:hello>'
clc '<bold:hello <underline: world>>'
clc '<red + bg blue + underline + bold:hello>'
clc -v
clc --version