XftColorAllocValue returns requested color, not closest approximation
The man page of Xft states, "An XftColor object permits text and other items to be rendered in a particular color (or the closest approximation offered by the X visual in use)." However, the code in xftcolor.c seems to return the requested color, not the color found by the X-server. I believe, the file xftcolor.c should be changed, as per the patch below. Unfortunately, at the moment I do not have a, e.g., grayscale screen at hand to test the issue.
--- a/a/xftcolor.c
+++ b/b/xftcolor.c
@@ -105,9 +105,9 @@ XftColorAllocValue (Display *dpy,
return False;
result->pixel = xcolor.pixel;
}
- result->color.red = color->red;
- result->color.green = color->green;
- result->color.blue = color->blue;
+ result->color.red = xcolor.red;
+ result->color.green = xcolor.green;
+ result->color.blue = xcolor.blue;
result->color.alpha = color->alpha;
return True;
}
Edited by Thomas E. Dickey