Difference between revisions of "ASCII Escapes For Bash"

From Nearline Storage
Jump to navigation Jump to search
(Created page with "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: {| style="margin-l...")
 
m
Line 7: Line 7:
 
{| style="margin-left: 20px;"
 
{| style="margin-left: 20px;"
 
|Black  
 
|Black  
|0;30
+
|00;30
 
|-
 
|-
|Dark Gray  
+
| style="color: #645c55" | Dark Gray  
|1;30
+
|01;30
 
|-
 
|-
|Blue  
+
| style="color: #1d1a93" | Blue  
|0;34
+
|00;34
 
|-
 
|-
|Light Blue  
+
| style="color: #6963e7" | Light Blue  
|1;34
+
|01;34
 
|-
 
|-
|Green
+
| style="color: #63e154" | Green
|0;32
+
|00;32
 
|-
 
|-
|Light Green
+
| style="color: #64e655" |Light Green
|1;32
+
|01;32
 
|-
 
|-
|Cyan
+
| style="color: #119590" | Cyan
|0;36
+
|00;36
 
|-
 
|-
|Light Cyan
+
| style="color: #5ee0d9" | Light Cyan
|1;36
+
|01;36
 
|-
 
|-
|Red
+
| style="color: #a30f08" | Red
|0;31
+
|00;31
 
|-
 
|-
|Light Red  
+
| style="color: #e6524b" | Light Red  
|1;31
+
|01;31
 
|-
 
|-
|Purple  
+
| style="color: #a51995" | Purple  
|0;35
+
|00;35
 
|-
 
|-
|Light Purple  
+
| style="color: #f15ddf" | Light Purple  
|1;35
+
|01;35
 
|-
 
|-
|Brown
+
| style="color: #a3570e" | Brown
|0;33
+
|00;33
 
|-
 
|-
|Yellow  
+
| style="color: #f0e756" | Yellow  
|1;33
+
|01;33
 
|-
 
|-
|Light Gray
+
| style="color: #a49c98" | Light Gray
|0;37
+
|00;37
 
|-
 
|-
 
|White
 
|White
|1;37
+
|01;37
 
|}
 
|}
  

Revision as of 18:15, 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
Blue 00;34
Light Blue 01;34
Green 00;32
Light Green 01;32
Cyan 00;36
Light Cyan 01;36
Red 00;31
Light Red 01;31
Purple 00;35
Light Purple 01;35
Brown 00;33
Yellow 01;33
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'