Friday, March 10, 2006

Terminal color code for vt100

This is very useful if you want to display your text messages in color from your c program(printf) on linux console


Format : esc[[{attribute};{foreground};{background}m
key stock for esc[ = CTRL+v ESC = hex char value of 0×1B(used in printf with %c format)
attribute 0 – reset, 1 – bright, 2 – dim, 3 – uderline
foreground (30 + color)
background (40 + color)
color 0 – black, 1 – red, 2 – green, 3 – yellow, 4 – blue

Example
^[[1;31;49m

Attr: Bold fg:red bg:white

0 Comments:

Post a Comment

<< Home