HOME ABOUT CONTACT ARTICLES

Unix Colour Codes


Docker is a set of coupled software-as-a-service and platform-as-a-service products that use operating-system-level virtualization to develop and deliver software in packages called containers.

Before beginning, you will need to install Docker. You can find installation instructions at https://docs.docker.com/install/

How to use

Inline

Inline is where we specify the colour codes within the string of the statement

luke@nebulae:~$ echo -e "\033[1;31mThis is going to be red\033[0m"
This is going to be red!


Using varaibles

Alternatively we can define colour codes as varibles and use them. This is best if you are using multiple colours multiple times.

end="\033[0m"
blue="\033[1;34m"
luke@nebulae:~$ echo -e "${blue}This is going to be blue ${end}"
This is going to be blue!

Codes

Text Colour - Normal

Red = "\033[0;31m" "Red (Normal)"
Green = "\033[0;32m" "Green (Normal)"
Yellow = "\033[0;33m" "Yellow (Normal)"
Blue = "\033[0;34m" "Blue (Normal)"
Purple = "\033[0;35m" "Purple (Normal)"
Cyan = "\033[0;36m" "Cyan (Normal)"

Text Colour - Bold

Red = "\033[1;31m" "Red (Bold)"
Green = "\033[1;32m" "Green (Bold)"
Yellow = "\033[1;33m" "Yellow (Bold)"
Blue = "\033[1;34m" "Blue (Bold)"
Purple = "\033[1;35m" "Purple (Bold)"
Cyan = "\033[1;36m" "Cyan (Bold)"

Text Colour - Italics

Red = "\033[3;31m" "Red (Italics)"
Green = "\033[3;32m" "Green (Italics)"
Yellow = "\033[3;33m" "Yellow (Italics)"
Blue = "\033[3;34m" "Blue (Italics)"
Purple = "\033[3;35m" "Purple (Italics)"
Cyan = "\033[3;36m" "Cyan (Italics)"

Text Colour - Underline

Red = "\033[4;31m" "Red (Underline)"
Green = "\033[4;32m" "Green (Underline)"
Yellow = "\033[4;33m" "Yellow (Underline)"
Blue = "\033[4;34m" "Blue (Underline)"
Purple = "\033[4;35m" "Purple (Underline)"
Cyan = "\033[4;36m" "Cyan (Underline)"