0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0755: terminal window does not have colors in the GUI

Problem:    Terminal window does not have colors in the GUI.
Solution:   Lookup the GUI color.
This commit is contained in:
Bram Moolenaar
2017-07-23 16:45:10 +02:00
parent eeac677886
commit 26af85d97b
16 changed files with 100 additions and 14 deletions

View File

@@ -2272,8 +2272,6 @@ gui_mch_get_color(char_u *name)
guicolor_T requested;
XColor available;
Colormap colormap;
#define COLORSPECBUFSIZE 8 /* space enough to hold "#RRGGBB" */
char spec[COLORSPECBUFSIZE];
/* can't do this when GUI not running */
if (!gui.in_use || name == NULL || *name == NUL)
@@ -2283,11 +2281,22 @@ gui_mch_get_color(char_u *name)
if (requested == INVALCOLOR)
return INVALCOLOR;
vim_snprintf(spec, COLORSPECBUFSIZE, "#%.2x%.2x%.2x",
return gui_mch_get_rgb_color(
(requested & 0xff0000) >> 16,
(requested & 0xff00) >> 8,
requested & 0xff);
#undef COLORSPECBUFSIZE
}
/*
* Return the Pixel value (color) for the given RGB values.
* Return INVALCOLOR for error.
*/
guicolor_T
gui_mch_get_rgb_color(int r, int g, int b)
{
char spec[8]; /* space enough to hold "#RRGGBB" */
vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b);
colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy));
if (XParseColor(gui.dpy, colormap, (char *)spec, &available) != 0
&& XAllocColor(gui.dpy, colormap, &available) != 0)