Difference between revisions of "ASCII Escapes For Bash"

From Nearline Storage
Jump to navigation Jump to search
m
m
Line 5: Line 5:
 
Echo (echo -e) the following escape codes inside \e[ESCCODEm to colorize text in Bash:
 
Echo (echo -e) the following escape codes inside \e[ESCCODEm to colorize text in Bash:
  
{| style="margin-left: 20px;"
+
{| style="margin-left: 40px;"
|Black  
+
| style="font-weight: bold;" | Black  
 
|00;30
 
|00;30
 
|-
 
|-
| style="color: #645c55" | Dark Gray  
+
| style="color: #645c55; font-weight: bold;" | Dark Gray  
 
|01;30
 
|01;30
 
|-
 
|-
| style="color: #1d1a93" | Blue
+
| style="color: #a30f08; font-weight: bold;" | Red
|00;34
+
|00;31
 
|-
 
|-
| style="color: #6963e7" | Light Blue
+
| style="color: #e6524b; font-weight: bold;" | Light Red
|01;34
+
|01;31
 
|-
 
|-
| style="color: #63e154" | Green
+
| style="color: #63e154; font-weight: bold;" | Green
 
|00;32
 
|00;32
 
|-
 
|-
| style="color: #64e655" |Light Green
+
| style="color: #64e655; font-weight: bold;" |Light Green
 
|01;32
 
|01;32
 
|-
 
|-
| style="color: #119590" | Cyan
+
| style="color: #a3570e; font-weight: bold;" | Brown
|00;36
+
|00;33
 
|-
 
|-
| style="color: #5ee0d9" | Light Cyan
+
| style="color: #f0e756; font-weight: bold;" | Yellow
|01;36
+
|01;33
 
|-
 
|-
| style="color: #a30f08" | Red
+
| style="color: #1d1a93; font-weight: bold;" | Blue
|00;31
+
|00;34
 
|-
 
|-
| style="color: #e6524b" | Light Red
+
| style="color: #6963e7; font-weight: bold;" | Light Blue
|01;31
+
|01;34
 
|-
 
|-
| style="color: #a51995" | Purple  
+
| style="color: #a51995; font-weight: bold;" | Purple  
 
|00;35
 
|00;35
 
|-
 
|-
| style="color: #f15ddf" | Light Purple  
+
| style="color: #f15ddf; font-weight: bold;" | Light Purple  
 
|01;35
 
|01;35
 
|-
 
|-
| style="color: #a3570e" | Brown
+
| style="color: #119590; font-weight: bold;" | Cyan
|00;33
+
|00;36
 
|-
 
|-
| style="color: #f0e756" | Yellow
+
| style="color: #5ee0d9; font-weight: bold;" | Light Cyan
|01;33
+
|01;36
 
|-
 
|-
| style="color: #a49c98" | Light Gray
+
| style="color: #a49c98; font-weight: bold;" | Light Gray
 
|00;37
 
|00;37
 
|-
 
|-
|White
+
| style="font-weight: bold;" | White
 
|01;37
 
|01;37
 
|}
 
|}

Revision as of 18:19, 31 August 2013

Stolen from http://hacktux.com/bash/colors

Bash Color Escape Codes

Echo (echo -e) the following escape codes inside \e[ESCCODEm to colorize text in Bash:

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

Make sure to use echo -e to enable interpretation of backslash escapes:

bash$ echo -e "This is red->\e[00;31mRED\e[00m"

Remove Color

Echo \e[00m to remove text color modifications:

bash$ echo -n '\e[00m'