Colorful Linux Terminal

I have created  a script to send report on daily basis,but management  want some of the line  colorful ,
As always believe "zaroorat aijad ki maa hai" so  I get tips of colorful terminal,
following are the point.

===================================
Color code in linux.
Black        0;30     Dark Gray     1;30
Red          0;31     Light Red     1;31
Green        0;32     Light Green   1;32
Brown/Orange 0;33     Yellow        1;33
Blue         0;34     Light Blue    1;34
Purple       0;35     Light Purple  1;35
Cyan         0;36     Light Cyan    1;36
Light Gray   0;37     White         1;37
====================================================

type of color sequence:

  1. 3/4 bit
  2. 8 bit
  3. 24 bit 
====================
Modes:

color-mode

  • 0 reset
  • 1; lighter than normal
  • 2; darker than normal 
  • ===============

text-mode

  • 3; italic
  • 4; underline
  • 5; blinking (slow)
  • 6; blinking (fast)
  • 7; reverse
  • 8; hide
  • 9; cross-out 

foreground mode

This mode is for colorizing the foreground

background mode

This mode is for colorizing the background. 

Example.

echo "-----------\033[5;42mCpu Max Utilization ----Cpu is Normal\033[m----------\n" >> /tmp/report.csv 

================================

Output.

We can colorized our terminal  with above step,by using above color code with command can use 0; for no color or reset,color.

 Link

I have followed below link.

https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux 


Comments

Popular posts from this blog