mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
api/vim: allow guis and tests to retrieve the entire color table
This commit is contained in:
parent
ae2b747e64
commit
f468fb70cb
@ -552,6 +552,18 @@ Integer vim_name_to_color(String name)
|
||||
return name_to_color((uint8_t *)name.data);
|
||||
}
|
||||
|
||||
Dictionary vim_get_color_map(void)
|
||||
{
|
||||
Dictionary colors = ARRAY_DICT_INIT;
|
||||
|
||||
for (int i = 0; color_name_table[i].name != NULL; i++) {
|
||||
PUT(colors, color_name_table[i].name,
|
||||
INTEGER_OBJ(color_name_table[i].color));
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
Array vim_get_api_info(uint64_t channel_id)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
|
@ -7645,184 +7645,181 @@ char_u *get_highlight_name(expand_T *xp, int idx)
|
||||
return HL_TABLE()[idx].sg_name;
|
||||
}
|
||||
|
||||
#define RGB(r, g, b) ((r << 16) | (g << 8) | b)
|
||||
color_name_table_T color_name_table[] = {
|
||||
// Color names taken from
|
||||
// http://www.rapidtables.com/web/color/RGB_Color.htm
|
||||
{"Maroon", RGB(0x80, 0x00, 0x00)},
|
||||
{"DarkRed", RGB(0x8b, 0x00, 0x00)},
|
||||
{"Brown", RGB(0xa5, 0x2a, 0x2a)},
|
||||
{"Firebrick", RGB(0xb2, 0x22, 0x22)},
|
||||
{"Crimson", RGB(0xdc, 0x14, 0x3c)},
|
||||
{"Red", RGB(0xff, 0x00, 0x00)},
|
||||
{"Tomato", RGB(0xff, 0x63, 0x47)},
|
||||
{"Coral", RGB(0xff, 0x7f, 0x50)},
|
||||
{"IndianRed", RGB(0xcd, 0x5c, 0x5c)},
|
||||
{"LightCoral", RGB(0xf0, 0x80, 0x80)},
|
||||
{"DarkSalmon", RGB(0xe9, 0x96, 0x7a)},
|
||||
{"Salmon", RGB(0xfa, 0x80, 0x72)},
|
||||
{"LightSalmon", RGB(0xff, 0xa0, 0x7a)},
|
||||
{"OrangeRed", RGB(0xff, 0x45, 0x00)},
|
||||
{"DarkOrange", RGB(0xff, 0x8c, 0x00)},
|
||||
{"Orange", RGB(0xff, 0xa5, 0x00)},
|
||||
{"Gold", RGB(0xff, 0xd7, 0x00)},
|
||||
{"DarkGoldenRod", RGB(0xb8, 0x86, 0x0b)},
|
||||
{"GoldenRod", RGB(0xda, 0xa5, 0x20)},
|
||||
{"PaleGoldenRod", RGB(0xee, 0xe8, 0xaa)},
|
||||
{"DarkKhaki", RGB(0xbd, 0xb7, 0x6b)},
|
||||
{"Khaki", RGB(0xf0, 0xe6, 0x8c)},
|
||||
{"Olive", RGB(0x80, 0x80, 0x00)},
|
||||
{"Yellow", RGB(0xff, 0xff, 0x00)},
|
||||
{"YellowGreen", RGB(0x9a, 0xcd, 0x32)},
|
||||
{"DarkOliveGreen", RGB(0x55, 0x6b, 0x2f)},
|
||||
{"OliveDrab", RGB(0x6b, 0x8e, 0x23)},
|
||||
{"LawnGreen", RGB(0x7c, 0xfc, 0x00)},
|
||||
{"ChartReuse", RGB(0x7f, 0xff, 0x00)},
|
||||
{"GreenYellow", RGB(0xad, 0xff, 0x2f)},
|
||||
{"DarkGreen", RGB(0x00, 0x64, 0x00)},
|
||||
{"Green", RGB(0x00, 0x80, 0x00)},
|
||||
{"ForestGreen", RGB(0x22, 0x8b, 0x22)},
|
||||
{"Lime", RGB(0x00, 0xff, 0x00)},
|
||||
{"LimeGreen", RGB(0x32, 0xcd, 0x32)},
|
||||
{"LightGreen", RGB(0x90, 0xee, 0x90)},
|
||||
{"PaleGreen", RGB(0x98, 0xfb, 0x98)},
|
||||
{"DarkSeaGreen", RGB(0x8f, 0xbc, 0x8f)},
|
||||
{"MediumSpringGreen", RGB(0x00, 0xfa, 0x9a)},
|
||||
{"SpringGreen", RGB(0x00, 0xff, 0x7f)},
|
||||
{"SeaGreen", RGB(0x2e, 0x8b, 0x57)},
|
||||
{"MediumAquamarine", RGB(0x66, 0xcd, 0xaa)},
|
||||
{"MediumSeaGreen", RGB(0x3c, 0xb3, 0x71)},
|
||||
{"LightSeaGreen", RGB(0x20, 0xb2, 0xaa)},
|
||||
{"DarkSlateGray", RGB(0x2f, 0x4f, 0x4f)},
|
||||
{"Teal", RGB(0x00, 0x80, 0x80)},
|
||||
{"DarkCyan", RGB(0x00, 0x8b, 0x8b)},
|
||||
{"Aqua", RGB(0x00, 0xff, 0xff)},
|
||||
{"Cyan", RGB(0x00, 0xff, 0xff)},
|
||||
{"LightCyan", RGB(0xe0, 0xff, 0xff)},
|
||||
{"DarkTurquoise", RGB(0x00, 0xce, 0xd1)},
|
||||
{"Turquoise", RGB(0x40, 0xe0, 0xd0)},
|
||||
{"MediumTurquoise", RGB(0x48, 0xd1, 0xcc)},
|
||||
{"PaleTurquoise", RGB(0xaf, 0xee, 0xee)},
|
||||
{"Aquamarine", RGB(0x7f, 0xff, 0xd4)},
|
||||
{"PowderBlue", RGB(0xb0, 0xe0, 0xe6)},
|
||||
{"CadetBlue", RGB(0x5f, 0x9e, 0xa0)},
|
||||
{"SteelBlue", RGB(0x46, 0x82, 0xb4)},
|
||||
{"CornFlowerBlue", RGB(0x64, 0x95, 0xed)},
|
||||
{"DeepSkyBlue", RGB(0x00, 0xbf, 0xff)},
|
||||
{"DodgerBlue", RGB(0x1e, 0x90, 0xff)},
|
||||
{"LightBlue", RGB(0xad, 0xd8, 0xe6)},
|
||||
{"SkyBlue", RGB(0x87, 0xce, 0xeb)},
|
||||
{"LightSkyBlue", RGB(0x87, 0xce, 0xfa)},
|
||||
{"MidnightBlue", RGB(0x19, 0x19, 0x70)},
|
||||
{"Navy", RGB(0x00, 0x00, 0x80)},
|
||||
{"DarkBlue", RGB(0x00, 0x00, 0x8b)},
|
||||
{"MediumBlue", RGB(0x00, 0x00, 0xcd)},
|
||||
{"Blue", RGB(0x00, 0x00, 0xff)},
|
||||
{"RoyalBlue", RGB(0x41, 0x69, 0xe1)},
|
||||
{"BlueViolet", RGB(0x8a, 0x2b, 0xe2)},
|
||||
{"Indigo", RGB(0x4b, 0x00, 0x82)},
|
||||
{"DarkSlateBlue", RGB(0x48, 0x3d, 0x8b)},
|
||||
{"SlateBlue", RGB(0x6a, 0x5a, 0xcd)},
|
||||
{"MediumSlateBlue", RGB(0x7b, 0x68, 0xee)},
|
||||
{"MediumPurple", RGB(0x93, 0x70, 0xdb)},
|
||||
{"DarkMagenta", RGB(0x8b, 0x00, 0x8b)},
|
||||
{"DarkViolet", RGB(0x94, 0x00, 0xd3)},
|
||||
{"DarkOrchid", RGB(0x99, 0x32, 0xcc)},
|
||||
{"MediumOrchid", RGB(0xba, 0x55, 0xd3)},
|
||||
{"Purple", RGB(0x80, 0x00, 0x80)},
|
||||
{"Thistle", RGB(0xd8, 0xbf, 0xd8)},
|
||||
{"Plum", RGB(0xdd, 0xa0, 0xdd)},
|
||||
{"Violet", RGB(0xee, 0x82, 0xee)},
|
||||
{"Magenta", RGB(0xff, 0x00, 0xff)},
|
||||
{"Fuchsia", RGB(0xff, 0x00, 0xff)},
|
||||
{"Orchid", RGB(0xda, 0x70, 0xd6)},
|
||||
{"MediumVioletRed", RGB(0xc7, 0x15, 0x85)},
|
||||
{"PaleVioletRed", RGB(0xdb, 0x70, 0x93)},
|
||||
{"DeepPink", RGB(0xff, 0x14, 0x93)},
|
||||
{"HotPink", RGB(0xff, 0x69, 0xb4)},
|
||||
{"LightPink", RGB(0xff, 0xb6, 0xc1)},
|
||||
{"Pink", RGB(0xff, 0xc0, 0xcb)},
|
||||
{"AntiqueWhite", RGB(0xfa, 0xeb, 0xd7)},
|
||||
{"Beige", RGB(0xf5, 0xf5, 0xdc)},
|
||||
{"Bisque", RGB(0xff, 0xe4, 0xc4)},
|
||||
{"BlanchedAlmond", RGB(0xff, 0xeb, 0xcd)},
|
||||
{"Wheat", RGB(0xf5, 0xde, 0xb3)},
|
||||
{"Cornsilk", RGB(0xff, 0xf8, 0xdc)},
|
||||
{"LemonChiffon", RGB(0xff, 0xfa, 0xcd)},
|
||||
{"LightGoldenRodYellow", RGB(0xfa, 0xfa, 0xd2)},
|
||||
{"LightYellow", RGB(0xff, 0xff, 0xe0)},
|
||||
{"SaddleBrown", RGB(0x8b, 0x45, 0x13)},
|
||||
{"Sienna", RGB(0xa0, 0x52, 0x2d)},
|
||||
{"Chocolate", RGB(0xd2, 0x69, 0x1e)},
|
||||
{"Peru", RGB(0xcd, 0x85, 0x3f)},
|
||||
{"SandyBrown", RGB(0xf4, 0xa4, 0x60)},
|
||||
{"BurlyWood", RGB(0xde, 0xb8, 0x87)},
|
||||
{"Tan", RGB(0xd2, 0xb4, 0x8c)},
|
||||
{"RosyBrown", RGB(0xbc, 0x8f, 0x8f)},
|
||||
{"Moccasin", RGB(0xff, 0xe4, 0xb5)},
|
||||
{"NavajoWhite", RGB(0xff, 0xde, 0xad)},
|
||||
{"PeachPuff", RGB(0xff, 0xda, 0xb9)},
|
||||
{"MistyRose", RGB(0xff, 0xe4, 0xe1)},
|
||||
{"LavenderBlush", RGB(0xff, 0xf0, 0xf5)},
|
||||
{"Linen", RGB(0xfa, 0xf0, 0xe6)},
|
||||
{"Oldlace", RGB(0xfd, 0xf5, 0xe6)},
|
||||
{"PapayaWhip", RGB(0xff, 0xef, 0xd5)},
|
||||
{"SeaShell", RGB(0xff, 0xf5, 0xee)},
|
||||
{"MintCream", RGB(0xf5, 0xff, 0xfa)},
|
||||
{"SlateGray", RGB(0x70, 0x80, 0x90)},
|
||||
{"LightSlateGray", RGB(0x77, 0x88, 0x99)},
|
||||
{"LightSteelBlue", RGB(0xb0, 0xc4, 0xde)},
|
||||
{"Lavender", RGB(0xe6, 0xe6, 0xfa)},
|
||||
{"FloralWhite", RGB(0xff, 0xfa, 0xf0)},
|
||||
{"AliceBlue", RGB(0xf0, 0xf8, 0xff)},
|
||||
{"GhostWhite", RGB(0xf8, 0xf8, 0xff)},
|
||||
{"Honeydew", RGB(0xf0, 0xff, 0xf0)},
|
||||
{"Ivory", RGB(0xff, 0xff, 0xf0)},
|
||||
{"Azure", RGB(0xf0, 0xff, 0xff)},
|
||||
{"Snow", RGB(0xff, 0xfa, 0xfa)},
|
||||
{"Black", RGB(0x00, 0x00, 0x00)},
|
||||
{"DimGray", RGB(0x69, 0x69, 0x69)},
|
||||
{"DimGrey", RGB(0x69, 0x69, 0x69)},
|
||||
{"Gray", RGB(0x80, 0x80, 0x80)},
|
||||
{"Grey", RGB(0x80, 0x80, 0x80)},
|
||||
{"DarkGray", RGB(0xa9, 0xa9, 0xa9)},
|
||||
{"DarkGrey", RGB(0xa9, 0xa9, 0xa9)},
|
||||
{"Silver", RGB(0xc0, 0xc0, 0xc0)},
|
||||
{"LightGray", RGB(0xd3, 0xd3, 0xd3)},
|
||||
{"LightGrey", RGB(0xd3, 0xd3, 0xd3)},
|
||||
{"Gainsboro", RGB(0xdc, 0xdc, 0xdc)},
|
||||
{"WhiteSmoke", RGB(0xf5, 0xf5, 0xf5)},
|
||||
{"White", RGB(0xff, 0xff, 0xff)},
|
||||
// The color names below were taken from gui_x11.c in vim source
|
||||
{"LightRed", RGB(0xff, 0xbb, 0xbb)},
|
||||
{"LightMagenta",RGB(0xff, 0xbb, 0xff)},
|
||||
{"DarkYellow", RGB(0xbb, 0xbb, 0x00)},
|
||||
{"Gray10", RGB(0x1a, 0x1a, 0x1a)},
|
||||
{"Grey10", RGB(0x1a, 0x1a, 0x1a)},
|
||||
{"Gray20", RGB(0x33, 0x33, 0x33)},
|
||||
{"Grey20", RGB(0x33, 0x33, 0x33)},
|
||||
{"Gray30", RGB(0x4d, 0x4d, 0x4d)},
|
||||
{"Grey30", RGB(0x4d, 0x4d, 0x4d)},
|
||||
{"Gray40", RGB(0x66, 0x66, 0x66)},
|
||||
{"Grey40", RGB(0x66, 0x66, 0x66)},
|
||||
{"Gray50", RGB(0x7f, 0x7f, 0x7f)},
|
||||
{"Grey50", RGB(0x7f, 0x7f, 0x7f)},
|
||||
{"Gray60", RGB(0x99, 0x99, 0x99)},
|
||||
{"Grey60", RGB(0x99, 0x99, 0x99)},
|
||||
{"Gray70", RGB(0xb3, 0xb3, 0xb3)},
|
||||
{"Grey70", RGB(0xb3, 0xb3, 0xb3)},
|
||||
{"Gray80", RGB(0xcc, 0xcc, 0xcc)},
|
||||
{"Grey80", RGB(0xcc, 0xcc, 0xcc)},
|
||||
{"Gray90", RGB(0xe5, 0xe5, 0xe5)},
|
||||
{"Grey90", RGB(0xe5, 0xe5, 0xe5)},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
RgbValue name_to_color(uint8_t *name)
|
||||
{
|
||||
#define RGB(r, g, b) ((r << 16) | (g << 8) | b)
|
||||
static struct {
|
||||
char *name;
|
||||
RgbValue color;
|
||||
} color_name_table[] = {
|
||||
// Color names taken from
|
||||
// http://www.rapidtables.com/web/color/RGB_Color.htm
|
||||
{"Maroon", RGB(0x80, 0x00, 0x00)},
|
||||
{"DarkRed", RGB(0x8b, 0x00, 0x00)},
|
||||
{"Brown", RGB(0xa5, 0x2a, 0x2a)},
|
||||
{"Firebrick", RGB(0xb2, 0x22, 0x22)},
|
||||
{"Crimson", RGB(0xdc, 0x14, 0x3c)},
|
||||
{"Red", RGB(0xff, 0x00, 0x00)},
|
||||
{"Tomato", RGB(0xff, 0x63, 0x47)},
|
||||
{"Coral", RGB(0xff, 0x7f, 0x50)},
|
||||
{"IndianRed", RGB(0xcd, 0x5c, 0x5c)},
|
||||
{"LightCoral", RGB(0xf0, 0x80, 0x80)},
|
||||
{"DarkSalmon", RGB(0xe9, 0x96, 0x7a)},
|
||||
{"Salmon", RGB(0xfa, 0x80, 0x72)},
|
||||
{"LightSalmon", RGB(0xff, 0xa0, 0x7a)},
|
||||
{"OrangeRed", RGB(0xff, 0x45, 0x00)},
|
||||
{"DarkOrange", RGB(0xff, 0x8c, 0x00)},
|
||||
{"Orange", RGB(0xff, 0xa5, 0x00)},
|
||||
{"Gold", RGB(0xff, 0xd7, 0x00)},
|
||||
{"DarkGoldenRod", RGB(0xb8, 0x86, 0x0b)},
|
||||
{"GoldenRod", RGB(0xda, 0xa5, 0x20)},
|
||||
{"PaleGoldenRod", RGB(0xee, 0xe8, 0xaa)},
|
||||
{"DarkKhaki", RGB(0xbd, 0xb7, 0x6b)},
|
||||
{"Khaki", RGB(0xf0, 0xe6, 0x8c)},
|
||||
{"Olive", RGB(0x80, 0x80, 0x00)},
|
||||
{"Yellow", RGB(0xff, 0xff, 0x00)},
|
||||
{"YellowGreen", RGB(0x9a, 0xcd, 0x32)},
|
||||
{"DarkOliveGreen", RGB(0x55, 0x6b, 0x2f)},
|
||||
{"OliveDrab", RGB(0x6b, 0x8e, 0x23)},
|
||||
{"LawnGreen", RGB(0x7c, 0xfc, 0x00)},
|
||||
{"ChartReuse", RGB(0x7f, 0xff, 0x00)},
|
||||
{"GreenYellow", RGB(0xad, 0xff, 0x2f)},
|
||||
{"DarkGreen", RGB(0x00, 0x64, 0x00)},
|
||||
{"Green", RGB(0x00, 0x80, 0x00)},
|
||||
{"ForestGreen", RGB(0x22, 0x8b, 0x22)},
|
||||
{"Lime", RGB(0x00, 0xff, 0x00)},
|
||||
{"LimeGreen", RGB(0x32, 0xcd, 0x32)},
|
||||
{"LightGreen", RGB(0x90, 0xee, 0x90)},
|
||||
{"PaleGreen", RGB(0x98, 0xfb, 0x98)},
|
||||
{"DarkSeaGreen", RGB(0x8f, 0xbc, 0x8f)},
|
||||
{"MediumSpringGreen", RGB(0x00, 0xfa, 0x9a)},
|
||||
{"SpringGreen", RGB(0x00, 0xff, 0x7f)},
|
||||
{"SeaGreen", RGB(0x2e, 0x8b, 0x57)},
|
||||
{"MediumAquamarine", RGB(0x66, 0xcd, 0xaa)},
|
||||
{"MediumSeaGreen", RGB(0x3c, 0xb3, 0x71)},
|
||||
{"LightSeaGreen", RGB(0x20, 0xb2, 0xaa)},
|
||||
{"DarkSlateGray", RGB(0x2f, 0x4f, 0x4f)},
|
||||
{"Teal", RGB(0x00, 0x80, 0x80)},
|
||||
{"DarkCyan", RGB(0x00, 0x8b, 0x8b)},
|
||||
{"Aqua", RGB(0x00, 0xff, 0xff)},
|
||||
{"Cyan", RGB(0x00, 0xff, 0xff)},
|
||||
{"LightCyan", RGB(0xe0, 0xff, 0xff)},
|
||||
{"DarkTurquoise", RGB(0x00, 0xce, 0xd1)},
|
||||
{"Turquoise", RGB(0x40, 0xe0, 0xd0)},
|
||||
{"MediumTurquoise", RGB(0x48, 0xd1, 0xcc)},
|
||||
{"PaleTurquoise", RGB(0xaf, 0xee, 0xee)},
|
||||
{"Aquamarine", RGB(0x7f, 0xff, 0xd4)},
|
||||
{"PowderBlue", RGB(0xb0, 0xe0, 0xe6)},
|
||||
{"CadetBlue", RGB(0x5f, 0x9e, 0xa0)},
|
||||
{"SteelBlue", RGB(0x46, 0x82, 0xb4)},
|
||||
{"CornFlowerBlue", RGB(0x64, 0x95, 0xed)},
|
||||
{"DeepSkyBlue", RGB(0x00, 0xbf, 0xff)},
|
||||
{"DodgerBlue", RGB(0x1e, 0x90, 0xff)},
|
||||
{"LightBlue", RGB(0xad, 0xd8, 0xe6)},
|
||||
{"SkyBlue", RGB(0x87, 0xce, 0xeb)},
|
||||
{"LightSkyBlue", RGB(0x87, 0xce, 0xfa)},
|
||||
{"MidnightBlue", RGB(0x19, 0x19, 0x70)},
|
||||
{"Navy", RGB(0x00, 0x00, 0x80)},
|
||||
{"DarkBlue", RGB(0x00, 0x00, 0x8b)},
|
||||
{"MediumBlue", RGB(0x00, 0x00, 0xcd)},
|
||||
{"Blue", RGB(0x00, 0x00, 0xff)},
|
||||
{"RoyalBlue", RGB(0x41, 0x69, 0xe1)},
|
||||
{"BlueViolet", RGB(0x8a, 0x2b, 0xe2)},
|
||||
{"Indigo", RGB(0x4b, 0x00, 0x82)},
|
||||
{"DarkSlateBlue", RGB(0x48, 0x3d, 0x8b)},
|
||||
{"SlateBlue", RGB(0x6a, 0x5a, 0xcd)},
|
||||
{"MediumSlateBlue", RGB(0x7b, 0x68, 0xee)},
|
||||
{"MediumPurple", RGB(0x93, 0x70, 0xdb)},
|
||||
{"DarkMagenta", RGB(0x8b, 0x00, 0x8b)},
|
||||
{"DarkViolet", RGB(0x94, 0x00, 0xd3)},
|
||||
{"DarkOrchid", RGB(0x99, 0x32, 0xcc)},
|
||||
{"MediumOrchid", RGB(0xba, 0x55, 0xd3)},
|
||||
{"Purple", RGB(0x80, 0x00, 0x80)},
|
||||
{"Thistle", RGB(0xd8, 0xbf, 0xd8)},
|
||||
{"Plum", RGB(0xdd, 0xa0, 0xdd)},
|
||||
{"Violet", RGB(0xee, 0x82, 0xee)},
|
||||
{"Magenta", RGB(0xff, 0x00, 0xff)},
|
||||
{"Fuchsia", RGB(0xff, 0x00, 0xff)},
|
||||
{"Orchid", RGB(0xda, 0x70, 0xd6)},
|
||||
{"MediumVioletRed", RGB(0xc7, 0x15, 0x85)},
|
||||
{"PaleVioletRed", RGB(0xdb, 0x70, 0x93)},
|
||||
{"DeepPink", RGB(0xff, 0x14, 0x93)},
|
||||
{"HotPink", RGB(0xff, 0x69, 0xb4)},
|
||||
{"LightPink", RGB(0xff, 0xb6, 0xc1)},
|
||||
{"Pink", RGB(0xff, 0xc0, 0xcb)},
|
||||
{"AntiqueWhite", RGB(0xfa, 0xeb, 0xd7)},
|
||||
{"Beige", RGB(0xf5, 0xf5, 0xdc)},
|
||||
{"Bisque", RGB(0xff, 0xe4, 0xc4)},
|
||||
{"BlanchedAlmond", RGB(0xff, 0xeb, 0xcd)},
|
||||
{"Wheat", RGB(0xf5, 0xde, 0xb3)},
|
||||
{"Cornsilk", RGB(0xff, 0xf8, 0xdc)},
|
||||
{"LemonChiffon", RGB(0xff, 0xfa, 0xcd)},
|
||||
{"LightGoldenRodYellow", RGB(0xfa, 0xfa, 0xd2)},
|
||||
{"LightYellow", RGB(0xff, 0xff, 0xe0)},
|
||||
{"SaddleBrown", RGB(0x8b, 0x45, 0x13)},
|
||||
{"Sienna", RGB(0xa0, 0x52, 0x2d)},
|
||||
{"Chocolate", RGB(0xd2, 0x69, 0x1e)},
|
||||
{"Peru", RGB(0xcd, 0x85, 0x3f)},
|
||||
{"SandyBrown", RGB(0xf4, 0xa4, 0x60)},
|
||||
{"BurlyWood", RGB(0xde, 0xb8, 0x87)},
|
||||
{"Tan", RGB(0xd2, 0xb4, 0x8c)},
|
||||
{"RosyBrown", RGB(0xbc, 0x8f, 0x8f)},
|
||||
{"Moccasin", RGB(0xff, 0xe4, 0xb5)},
|
||||
{"NavajoWhite", RGB(0xff, 0xde, 0xad)},
|
||||
{"PeachPuff", RGB(0xff, 0xda, 0xb9)},
|
||||
{"MistyRose", RGB(0xff, 0xe4, 0xe1)},
|
||||
{"LavenderBlush", RGB(0xff, 0xf0, 0xf5)},
|
||||
{"Linen", RGB(0xfa, 0xf0, 0xe6)},
|
||||
{"Oldlace", RGB(0xfd, 0xf5, 0xe6)},
|
||||
{"PapayaWhip", RGB(0xff, 0xef, 0xd5)},
|
||||
{"SeaShell", RGB(0xff, 0xf5, 0xee)},
|
||||
{"MintCream", RGB(0xf5, 0xff, 0xfa)},
|
||||
{"SlateGray", RGB(0x70, 0x80, 0x90)},
|
||||
{"LightSlateGray", RGB(0x77, 0x88, 0x99)},
|
||||
{"LightSteelBlue", RGB(0xb0, 0xc4, 0xde)},
|
||||
{"Lavender", RGB(0xe6, 0xe6, 0xfa)},
|
||||
{"FloralWhite", RGB(0xff, 0xfa, 0xf0)},
|
||||
{"AliceBlue", RGB(0xf0, 0xf8, 0xff)},
|
||||
{"GhostWhite", RGB(0xf8, 0xf8, 0xff)},
|
||||
{"Honeydew", RGB(0xf0, 0xff, 0xf0)},
|
||||
{"Ivory", RGB(0xff, 0xff, 0xf0)},
|
||||
{"Azure", RGB(0xf0, 0xff, 0xff)},
|
||||
{"Snow", RGB(0xff, 0xfa, 0xfa)},
|
||||
{"Black", RGB(0x00, 0x00, 0x00)},
|
||||
{"DimGray", RGB(0x69, 0x69, 0x69)},
|
||||
{"DimGrey", RGB(0x69, 0x69, 0x69)},
|
||||
{"Gray", RGB(0x80, 0x80, 0x80)},
|
||||
{"Grey", RGB(0x80, 0x80, 0x80)},
|
||||
{"DarkGray", RGB(0xa9, 0xa9, 0xa9)},
|
||||
{"DarkGrey", RGB(0xa9, 0xa9, 0xa9)},
|
||||
{"Silver", RGB(0xc0, 0xc0, 0xc0)},
|
||||
{"LightGray", RGB(0xd3, 0xd3, 0xd3)},
|
||||
{"LightGrey", RGB(0xd3, 0xd3, 0xd3)},
|
||||
{"Gainsboro", RGB(0xdc, 0xdc, 0xdc)},
|
||||
{"WhiteSmoke", RGB(0xf5, 0xf5, 0xf5)},
|
||||
{"White", RGB(0xff, 0xff, 0xff)},
|
||||
// The color names below were taken from gui_x11.c in vim source
|
||||
{"LightRed", RGB(0xff, 0xbb, 0xbb)},
|
||||
{"LightMagenta",RGB(0xff, 0xbb, 0xff)},
|
||||
{"DarkYellow", RGB(0xbb, 0xbb, 0x00)},
|
||||
{"Gray10", RGB(0x1a, 0x1a, 0x1a)},
|
||||
{"Grey10", RGB(0x1a, 0x1a, 0x1a)},
|
||||
{"Gray20", RGB(0x33, 0x33, 0x33)},
|
||||
{"Grey20", RGB(0x33, 0x33, 0x33)},
|
||||
{"Gray30", RGB(0x4d, 0x4d, 0x4d)},
|
||||
{"Grey30", RGB(0x4d, 0x4d, 0x4d)},
|
||||
{"Gray40", RGB(0x66, 0x66, 0x66)},
|
||||
{"Grey40", RGB(0x66, 0x66, 0x66)},
|
||||
{"Gray50", RGB(0x7f, 0x7f, 0x7f)},
|
||||
{"Grey50", RGB(0x7f, 0x7f, 0x7f)},
|
||||
{"Gray60", RGB(0x99, 0x99, 0x99)},
|
||||
{"Grey60", RGB(0x99, 0x99, 0x99)},
|
||||
{"Gray70", RGB(0xb3, 0xb3, 0xb3)},
|
||||
{"Grey70", RGB(0xb3, 0xb3, 0xb3)},
|
||||
{"Gray80", RGB(0xcc, 0xcc, 0xcc)},
|
||||
{"Grey80", RGB(0xcc, 0xcc, 0xcc)},
|
||||
{"Gray90", RGB(0xe5, 0xe5, 0xe5)},
|
||||
{"Grey90", RGB(0xe5, 0xe5, 0xe5)},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2])
|
||||
&& isxdigit(name[3]) && isxdigit(name[4]) && isxdigit(name[5])
|
||||
|
@ -38,6 +38,12 @@
|
||||
#define HL_CONCEAL 0x20000 /* can be concealed */
|
||||
#define HL_CONCEALENDS 0x40000 /* can be concealed */
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
RgbValue color;
|
||||
} color_name_table_T;
|
||||
extern color_name_table_T color_name_table[];
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "syntax.h.generated.h"
|
||||
#endif
|
||||
|
@ -29,14 +29,12 @@ end)
|
||||
describe('Default highlight groups', function()
|
||||
-- Test the default attributes for highlight groups shown by the :highlight
|
||||
-- command
|
||||
local screen, hlgroup_colors
|
||||
local screen
|
||||
|
||||
setup(function()
|
||||
hlgroup_colors = {
|
||||
NonText = nvim('name_to_color', 'Blue'),
|
||||
Question = nvim('name_to_color', 'SeaGreen')
|
||||
}
|
||||
end)
|
||||
local hlgroup_colors = {
|
||||
NonText = Screen.colors.Blue,
|
||||
Question = Screen.colors.SeaGreen
|
||||
}
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
|
@ -4,14 +4,12 @@ local clear, feed, nvim = helpers.clear, helpers.feed, helpers.nvim
|
||||
local insert, execute = helpers.insert, helpers.execute
|
||||
|
||||
describe('Mouse input', function()
|
||||
local screen, hlgroup_colors
|
||||
local screen
|
||||
|
||||
setup(function()
|
||||
hlgroup_colors = {
|
||||
NonText = nvim('name_to_color', 'Blue'),
|
||||
Visual = nvim('name_to_color', 'LightGrey'),
|
||||
}
|
||||
end)
|
||||
local hlgroup_colors = {
|
||||
NonText = Screen.colors.Blue,
|
||||
Visual = Screen.colors.LightGrey
|
||||
}
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
|
@ -65,7 +65,7 @@
|
||||
-- attribute(which normally is), here's how the call to "expect" should look
|
||||
-- like:
|
||||
--
|
||||
-- NonText = nvim('name_to_color', 'Blue'),
|
||||
-- NonText = Screen.colors.Blue
|
||||
-- screen:expect([[
|
||||
-- hello screen \
|
||||
-- ~ \
|
||||
@ -86,7 +86,7 @@
|
||||
--
|
||||
-- Multiple expect:s will likely share a group of attribute sets to test.
|
||||
-- Therefore these could be specified at the beginning of a test like this:
|
||||
-- NonText = nvim('name_to_color', 'Blue')
|
||||
-- NonText = Screen.colors.Blue
|
||||
-- screen:set_default_attr_ids( {
|
||||
-- [1] = {reverse = true, bold = true},
|
||||
-- [2] = {reverse = true}
|
||||
@ -119,6 +119,16 @@ if os.getenv('VALGRIND') then
|
||||
default_screen_timeout = 7500
|
||||
end
|
||||
|
||||
local colors = request('vim_get_color_map')
|
||||
local colornames = {}
|
||||
for name, rgb in pairs(colors) do
|
||||
-- we disregard the case that colornames might not be unique, as
|
||||
-- this is just a helper to get any canonical name of a color
|
||||
colornames[rgb] = name
|
||||
end
|
||||
|
||||
Screen.colors = colors
|
||||
|
||||
function Screen.debug(command)
|
||||
if not command then
|
||||
command = 'pynvim -n -g -c '
|
||||
@ -479,7 +489,13 @@ end
|
||||
function pprint_attrs(attrs)
|
||||
local items = {}
|
||||
for f, v in pairs(attrs) do
|
||||
table.insert(items, f.." = "..tostring(v))
|
||||
local desc = tostring(v)
|
||||
if f == "foreground" or f == "background" then
|
||||
if colornames[v] ~= nil then
|
||||
desc = "Screen.colors."..colornames[v]
|
||||
end
|
||||
end
|
||||
table.insert(items, f.." = "..desc)
|
||||
end
|
||||
return table.concat(items, ", ")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user