summaryrefslogtreecommitdiff
path: root/public/term-colors.md
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 13:47:42 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 13:47:42 -0400
commit6a42c8de66e3b2dc7293ddeadaa3ee396db2624d (patch)
tree67a027b892d3122662526504dd6d11e8dea02ca1 /public/term-colors.md
initial commit
Diffstat (limited to 'public/term-colors.md')
-rw-r--r--public/term-colors.md40
1 files changed, 40 insertions, 0 deletions
diff --git a/public/term-colors.md b/public/term-colors.md
new file mode 100644
index 0000000..bb945d0
--- /dev/null
+++ b/public/term-colors.md
@@ -0,0 +1,40 @@
+An explanation of common terminal emulator color codes
+======================================================
+:copyright 2013 Luke Shumaker
+
+This is based on a post on [reddit][1], published on 2013-03-21.
+
+[1]: http://www.reddit.com/r/commandline/comments/1aotaj/solarized_is_a_sixteen_color_palette_designed_for/c8ztxpt?context=1
+
+> So all terminals support the same 256 colors? What about 88 color
+> mode: is that a subset?
+
+TL;DR: yes
+
+Terminal compatibility is crazy complex, because nobody actually reads
+the spec, they just write something that is compatible for their
+tests. Then things have to be compatible with that terminal's quirks.
+
+But, here's how 8-color, 16-color, and 256 color work. IIRC, 88 color
+is a subset of the 256 color scheme, but I'm not sure.
+
+**8 colors: (actually 9)**
+First we had 8 colors (9 with "default", which doesn't have to be one
+of the 8). These are always roughly the same color: black, red, green,
+yellow/orange, blue, purple, cyan, and white, which are colors 0-7
+respectively. Color 9 is default.
+
+**16 colors: (actually 18)**
+Later, someone wanted to add more colors, so they added a "bright"
+attribute. So when bright is on, you get "bright red" instead of
+"red". Hence 8*2=16 (plus two more for "default" and "bright
+default").
+
+**256 colors: (actually 274)**
+You may have noticed, colors 0-7 and 9 are used, but 8 isn't. So,
+someone decided that color 8 should put the terminal into 256 color
+mode. In this mode, it reads another byte, which is an 8-bit RGB value
+(2 bits for red, 2 for green, 2 for blue). The bright property has no
+effect on these colors. However, a terminal can display 256-color-mode
+colors and 16-color-mode colors at the same time, so you actually get
+256+18 colors.