tweaks: adjust a comment for the changed handling of gray #rgb codes
This commit is contained in:
parent
86b8388889
commit
8804b6dcd4
@ -991,10 +991,11 @@ void parse_includes(char *ptr)
|
||||
}
|
||||
|
||||
/* Return the index of the color that is closest to the given RGB levels,
|
||||
* assuming that the terminal uses the 6x6x6 color cube of xterm-256color. */
|
||||
* assuming that the terminal uses the 6x6x6 color cube of xterm-256color.
|
||||
* When red == green == blue, return an index in the xterm gray scale. */
|
||||
short closest_index_color(short red, short green, short blue)
|
||||
{
|
||||
/* Translation table, from 16 intended levels to 6 available levels. */
|
||||
/* Translation table, from 16 intended color levels to 6 available levels. */
|
||||
static const short level[] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
|
||||
|
||||
/* Translation table, from 14 intended gray levels to 24 available levels. */
|
||||
@ -1002,7 +1003,7 @@ short closest_index_color(short red, short green, short blue)
|
||||
|
||||
if (COLORS != 256)
|
||||
return THE_DEFAULT;
|
||||
else if (red == green && red == blue && red > 0 && red < 0xF)
|
||||
else if (red == green && green == blue && 0 < red && red < 0xF)
|
||||
return 232 + gray[red - 1];
|
||||
else
|
||||
return (36 * level[red] + 6 * level[green] + level[blue] + 16);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user