Skip to content
/ clc Public

Tiny bash utility for coloring terminal output and prompt

License

Notifications You must be signed in to change notification settings

betafcc/clc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 [zsh|bash] for this)

for bash: PS1=$(clc -e bash '<bold:<red:[<yellow:\\u><green:@><blue:\\h><magenta:\\W>]>$ >')

for zsh: PS1=$(clc -e zsh '<bold:<red:[<yellow:%n><green:@><blue:%m><magenta:%1d>]>$ >')

Try it

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

Install

dest='/usr/local/bin/clc'; curl -s https://raw.githubusercontent.com/betafcc/clc/master/clc | sudo tee "${dest}" > /dev/null && sudo chmod +x "${dest}"

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>'
clc '<rgb 255 120 120: hello>'
clc '<#f66: hello>'
clc '<#66fa73: hello>'

Use background colors:

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

Use effects:

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

Combine commands:

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

Escape characters with '%':

clc '<red:%<hello world%>>'

Available Colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • rgb <0-255> <0-255> <0-255>
  • #000 - #fff
  • #000000 - #ffffff

Available effects:

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

Version:

clc -v
clc --version

About

Tiny bash utility for coloring terminal output and prompt

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages