Color Builder for Terminal

 

Nowadays terminals support 256 colors.

Why not use weird escape sequences in your nifty logging? Choose your preferred colors and copy the crazyescapes below.

 

\033[m

Styles



    fg     bg

Result

MY_CLR='\033[m' \
echo "${MY_CLR}Hello, world!

Hello, world!

Escape sequences

Feel free to use one of the following escape sequences (NB! Insert ^[ using Ctrl+V followed by Esc):

  • ^[[m
  • \e[m
  • \033[m

 

Kosher way

Terminfo suggests using tput command to manage terminal output instead of escape sequences. Though it is not always applicable (e. g. you might want to produce different outputs within one piece of code, making terminfo’s commands useless,) below is the tput command to yield the color chosen.

Background

Linux terminals have support for 256 colors. Not all of them know about it, though. To enable 256 colors simply export TERM=xterm-256color and enjoy.

I’m now a little bit tired creating the javascript-spaghetti inside this page. I’m to write a couple of words about technical details …uhmmm soon.