diff options
Diffstat (limited to 'public/term-colors.html')
-rw-r--r-- | public/term-colors.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/public/term-colors.html b/public/term-colors.html new file mode 100644 index 0000000..958d4e2 --- /dev/null +++ b/public/term-colors.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>An explanation of common terminal emulator color codes — Luke T. Shumaker</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="assets/style.css"> + <link rel="alternate" type="application/atom+xml" href="./index.atom" name="web log entries"/> +</head> +<body> +<header><a href="/">Luke T. Shumaker</a> » <a href=/blog>blog</a> » term-colors</header> +<article> +<h1 id="an-explanation-of-common-terminal-emulator-color-codes">An +explanation of common terminal emulator color codes</h1> +<p>This is based on a post on <a +href="http://www.reddit.com/r/commandline/comments/1aotaj/solarized_is_a_sixteen_color_palette_designed_for/c8ztxpt?context=1">reddit</a>, +published on 2013-03-21.</p> +<blockquote> +<p>So all terminals support the same 256 colors? What about 88 color +mode: is that a subset?</p> +</blockquote> +<p>TL;DR: yes</p> +<p>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.</p> +<p>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.</p> +<p><strong>8 colors: (actually 9)</strong> 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.</p> +<p><strong>16 colors: (actually 18)</strong> 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”).</p> +<p><strong>256 colors: (actually 274)</strong> 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.</p> + +</article> +<footer> + <aside class="sponsor"><p>I'd love it if you <a class="em" + href="/sponsor/">sponsored me</a>. It will allow me to continue + <a class="em" href="/imworkingon/">my work</a> on the GNU/Linux + ecosystem. Thanks!</p></aside> + +<p>The content of this page is Copyright © 2013 <a href="mailto:lukeshu@lukeshu.com">Luke T. Shumaker</a>.</p> +<p>This page is licensed under the <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a> license.</p> +</footer> +</body> +</html> |