Ansi colors

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "==Print a palette== Run this in bash: <source lang="bash"> for x in 4 10; do for y in $(seq 0 7); do echo -en "\0033[${x}${y}m "; done; echo -e "\0033[0m"; done </source>")
 
m (256-color)
 
(11 intermediate revisions by one user not shown)
Line 1: Line 1:
 
==Print a palette==
 
==Print a palette==
Run this in bash:
+
These palettes are generated from a 'clean' installation of XTerm (with no configuration).
 +
 
 +
=== 16-color ===
 
<source lang="bash">
 
<source lang="bash">
 
for x in 4 10; do for y in $(seq 0 7); do echo -en "\0033[${x}${y}m  "; done; echo -e "\0033[0m"; done
 
for x in 4 10; do for y in $(seq 0 7); do echo -en "\0033[${x}${y}m  "; done; echo -e "\0033[0m"; done
 
</source>
 
</source>
 +
[[File:xterm-palette.png]]
 +
 +
Some of these colors aren't good, and I prefer to use another. See the [[Xresources]] page for implementation of this.
 +
{| class="wikitable"
 +
! Brightness !! # !! ## !! Color !! Value !! Attie's Preferred
 +
|-
 +
|rowspan="8"| Normal || 0 || 0 || Black ||style="background-color:#000000;color:#FFF;"| #000000 || &larr;
 +
|-
 +
| 1 || 1 || Red ||style="background-color:#CD0000;"| #CD0000 || &larr;
 +
|-
 +
| 2 || 2 || Green ||style="background-color:#00CD00;"| #00CD00 || &larr;
 +
|-
 +
| 3 || 3 || Yellow ||style="background-color:#CDCD00;"| #CDCD00 || &larr;
 +
|-
 +
| 4 || 4 || Blue ||style="background-color:#0000EE;color:#FFF;"| #0000EE || &larr;
 +
|-
 +
| 5 || 5 || Magenta ||style="background-color:#CD00CD;"| #CD00CD || &larr;
 +
|-
 +
| 6 || 6 || Cyan ||style="background-color:#00CDCD;"| #00CDCD || &larr;
 +
|-
 +
| 7 || 7 || White ||style="background-color:#E5E5E5;"| #E5E5E5 || &larr;
 +
|-
 +
|rowspan="8"| Bright || 0 || 8 || Black ||style="background-color:#7F7F7F;color:#FFF;"| #7F7F7F || &larr;
 +
|-
 +
| 1 || 9 || Red ||style="background-color:#FF0000;"| #FF0000 || &larr;
 +
|-
 +
| 2 || 10 || Green ||style="background-color:#00FF00;"| #00FF00 || &larr;
 +
|-
 +
| 3 || 11 || Yellow ||style="background-color:#FFFF00;"| #FFFF00 ||style="background-color:#D78700;"| #D78700
 +
|-
 +
| 4 || 12 || Blue ||style="background-color:#5C5CFF;color:#FFF;"| #5C5CFF || &larr;
 +
|-
 +
| 5 || 13 || Magenta ||style="background-color:#FF00FF;"| #FF00FF || &larr;
 +
|-
 +
| 6 || 14 || Cyan ||style="background-color:#00FFFF;"| #00FFFF || &larr;
 +
|-
 +
| 7 || 15 || White ||style="background-color:#FFFFFF;"| #FFFFFF || &larr;
 +
|}
 +
 +
=== 256-color ===
 +
The colors before #16 are the same as above.
 +
<source lang="bash">
 +
for x in $(seq 16 6 255); do for y in $(seq ${x} $((x + 5))); do printf "\e[48;5;${y}m %-3d " ${y}; done; echo -e "\0033[0m"; done
 +
</source>
 +
[[File:xterm-palette-256.png]]

Latest revision as of 12:13, 14 March 2013

[edit] Print a palette

These palettes are generated from a 'clean' installation of XTerm (with no configuration).

[edit] 16-color

for x in 4 10; do for y in $(seq 0 7); do echo -en "\0033[${x}${y}m   "; done; echo -e "\0033[0m"; done

Xterm-palette.png

Some of these colors aren't good, and I prefer to use another. See the Xresources page for implementation of this.

Brightness # ## Color Value Attie's Preferred
Normal 0 0 Black #000000
1 1 Red #CD0000
2 2 Green #00CD00
3 3 Yellow #CDCD00
4 4 Blue #0000EE
5 5 Magenta #CD00CD
6 6 Cyan #00CDCD
7 7 White #E5E5E5
Bright 0 8 Black #7F7F7F
1 9 Red #FF0000
2 10 Green #00FF00
3 11 Yellow #FFFF00 #D78700
4 12 Blue #5C5CFF
5 13 Magenta #FF00FF
6 14 Cyan #00FFFF
7 15 White #FFFFFF

[edit] 256-color

The colors before #16 are the same as above.

for x in $(seq 16 6 255); do for y in $(seq ${x} $((x + 5))); do printf "\e[48;5;${y}m %-3d " ${y}; done; echo -e "\0033[0m"; done

Xterm-palette-256.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox