How are these assigned to the representations of DarkGray, etc. often used to define Vim colorschemes?
I can't speak for the actual design of the color schemes since that might require looking into mailing list archives to see if there were discussions about what would be good defaults.
But, in syntax.c
of Vim's source code, there's a table for limited palettes in the do_highlight()
function:
static char *(color_names[28]) = {
"Black", "DarkBlue", "DarkGreen", "DarkCyan",
"DarkRed", "DarkMagenta", "Brown", "DarkYellow",
"Gray", "Grey",
"LightGray", "LightGrey", "DarkGray", "DarkGrey",
"Blue", "LightBlue", "Green", "LightGreen",
"Cyan", "LightCyan", "Red", "LightRed", "Magenta",
"LightMagenta", "Yellow", "LightYellow", "White", "NONE"};
static int color_numbers_16[28] = {0, 1, 2, 3,
4, 5, 6, 6,
7, 7,
7, 7, 8, 8,
9, 9, 10, 10,
11, 11, 12, 12, 13,
13, 14, 14, 15, -1};
/* for xterm with 88 colors... */
static int color_numbers_88[28] = {0, 4, 2, 6,
1, 5, 32, 72,
84, 84,
7, 7, 82, 82,
12, 43, 10, 61,
14, 63, 9, 74, 13,
75, 11, 78, 15, -1};
/* for xterm with 256 colors... */
static int color_numbers_256[28] = {0, 4, 2, 6,
1, 5, 130, 130,
248, 248,
7, 7, 242, 242,
12, 81, 10, 121,
14, 159, 9, 224, 13,
225, 11, 229, 15, -1};
/* for terminals with less than 16 colors... */
static int color_numbers_8[28] = {0, 4, 2, 6,
1, 5, 3, 3,
7, 7,
7, 7, 0+8, 0+8,
4+8, 4+8, 2+8, 2+8,
6+8, 6+8, 1+8, 1+8, 5+8,
5+8, 3+8, 3+8, 7+8, -1};
DarkGray
's index is 12
in the color_names
table. Assuming you have an 16 color palette, you would get the 12th item in color_numbers_16
, which is color index 8. This would be the bright variant of color index 0
(8 % 8
) which is bright black
.