Add support for 256color xterm codes - #2
Conversation
jordansissel
commented
Jul 13, 2014
- 216-color RGB cube is supported as 'rgb' with range 0-5 for each color
- 16-color Grayscale is supported as 'grayN' where N is 0-15
jordansissel
commented
Jul 13, 2014
Visual test code: https://gist.github.com/jordansissel/49f3a76681987b08de4e |
jordansissel
commented
Jul 13, 2014
jordansissel
commented
Jul 13, 2014
Ready for review! Specific feedback requested:
|
* 216-color RGB cube is supported as 'rgb' with range 0-5 for each color * 16-color Grayscale is supported as 'grayN' where N is 0-15
jordansissel
commented
Jul 13, 2014
fmt.Printf("%s\n", colorstring.Color("[_200_]this should be red"))
fmt.Printf("%s\n", colorstring.Color("[_020_]this should be green"))
fmt.Printf("%s\n", colorstring.Color("[_002_]this should be blue"))
fmt.Printf("%s\n", colorstring.Color("[_220_]this should be yellow"))
fmt.Printf("%s\n", colorstring.Color("[_022_]this should be cyan"))
fmt.Printf("%s\n", colorstring.Color("[_202_]this should be purple"))
fmt.Printf("%s\n", colorstring.Color("[_222_]this should be grey")) |
mitchellh
commented
Jul 13, 2014
Hey! Looks good. Questoin: why not just use the 256-color color number as shown here? http://misc.flogisoft.com/bash/tip_colors_and_formatting Is the 0-6 "intensity" of a color some standard thing I'm unaware of? It might be easier to use the color numbers because then people can look it up. No? |
jordansissel
commented
Jul 14, 2014
The reason for the rgb syntax is that the numbers don't really have semantic meaning. Like colors in the web, where we do So terminal colors, is 216 colors of a 6x6x6 cube, so I picked base 6 (0-5) encoded as 3 digits RGB. Much easier for me to predict what a color will be |
jordansissel
commented
Jul 14, 2014
mitchellh
commented
Jul 15, 2014
This is reasonable. Let me take one quick review again tomorrow or tonight then I'll merge it in. Thanks! |
mpolden
commented
Jul 24, 2014
256 color support would be great. Any update on this? |
jippi
commented
Oct 5, 2017
@mitchellh bump? ^ :) |


