Awesome Open Source
Awesome Open Source

clc

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>]>$ >')

Try it

bash <(curl -s https://raw.githubusercontent.com/betafcc/clc/master/clc) '<red:hello <reverse:world>'

Install

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>'

More

Use foreground colors:

clc '<red:hello>'
clc '<green:hello <blue: world>>'
clc '<rgb 255 120 120: hello>'

Use background colors:

clc '<bg red:hello>'
clc '<bg green:hello <bg blue: world>>'
clc '<bg rgb 255 120 120: hello>'

Use effects:

clc '<bold:hello>'
clc '<bold:hello <underline: world>>'

Combine commands:

clc '<red + bg blue + underline + bold:hello>'

Available Colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • rgb <0-255> <0-255> <0-255>

Available effects:

  • normal
  • bold
  • dim
  • strike
  • italic
  • underline
  • reverse
  • invisible
  • blink

Version:

clc -v
clc --version

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
shell (9,849
bash (595
prompt (72
tiny (60
tty (43
formatting (31
ansi-colors (25

Find Open Source By Browsing 7,000 Topics Across 59 Categories