Skip navigation.
Home

IOS - Colors in CLI

Yes, you can put colors into your CLI of IOS. The keys for this feature are the escape characters and the terminal support for colors.
For example to create a banner like on the picture below you have to enter a banner command like this:

swr(config)#banner motd #
Enter TEXT message.  End with the character '#'.
< CTRL+V >< ESC >[1;33m

     _______.____    __    ____ .______
    /       |\   \  /  \  /   / |   _  \
   |   (----` \   \/    \/   /  |  |_)  |
    \   \      \            /   |      /
.----)   |      \    /\    /    |  |\  \----.
|_______/        \__/  \__/     | _| `._____|

< CTRL+V >< ESC >[0m
#
swr(config)#end
swr#exit
 
After pressing the CTRL+V, the command line switches to a special mode in which it can consume a special character like ESC or even the '?' (question mark). The "1;33" is a terminal code for a yelow color. So after entering the "^[[1;33m", everything after this sequence will be yelow :) If you want to change the colors at each line of your banner, then just start each line with this special sequnce and color code.
If you don't specifi at the end of the banner that "^[[0m" sequence, then not just the starting motd banner will be in colors, but everything (the prompt, the commands, ...). That can be useful when you are configuring more devices at one time - router1 will be in red color, router2 will be in yelow, ...

Some terminal colors code (from bash):

Black       0;30     Dark Gray     1;30
Blue        0;34     Light Blue    1;34
Green       0;32     Light Green   1;32
Cyan        0;36     Light Cyan    1;36
Red         0;31     Light Red     1;31
Purple      0;35     Light Purple  1;35
Brown       0;33     Yellow        1;33
Light Gray  0;37     White         1;37

ASCII code generator