Colours in Terminals

    arunsrin@ARUNSRIN-G2CA5 MINGW64 ~
    $ printf "\033[32mhi\033[0m"
  • \033 is Escape
  • So Escape + 3 + 2 + m tells the terminal that everything from this point onwards is in green.
  • And Escape + [ + 0 + m reverts it back to normal
  • These are some sequences:
Sequence   What it Does
ESC[1m     Bold, intensify foreground
ESC[4m     Underscore
ESC[5m     Blink
ESC[7m     Reverse video
ESC[0m     All attributes off

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s