summaryrefslogtreecommitdiffstats
path: root/xlib/xcolors.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlib/xcolors.c')
-rw-r--r--xlib/xcolors.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/xlib/xcolors.c b/xlib/xcolors.c
index 65f61ae..572f092 100644
--- a/xlib/xcolors.c
+++ b/xlib/xcolors.c
@@ -14,28 +14,6 @@
#include "tkInt.h"
/*
- * Special array for the colors gray9-gray100 (and grey9-grey100, which are
- * identical). (TODO: to be removed, because the values can be calculated)
- */
-
-static const char graymap[] = "\377\377\377\374\374\374\372\372\372\367\367\367"
- "\365\365\365\362\362\362\360\360\360\355\355\355\353\353\353\350\350\350"
- "\345\345\345\343\343\343\340\340\340\336\336\336\333\333\333\331\331\331"
- "\326\326\326\324\324\324\321\321\321\317\317\317\314\314\314\311\311\311"
- "\307\307\307\304\304\304\302\302\302\277\277\277\275\275\275\272\272\272"
- "\270\270\270\265\265\265\263\263\263\260\260\260\255\255\255\253\253\253"
- "\250\250\250\246\246\246\243\243\243\241\241\241\236\236\236\234\234\234"
- "\231\231\231\226\226\226\224\224\224\221\221\221\217\217\217\214\214\214"
- "\212\212\212\207\207\207\205\205\205\202\202\202\177\177\177\175\175\175"
- "\172\172\172\170\170\170\165\165\165\163\163\163\160\160\160\156\156\156"
- "\153\153\153\151\151\151\146\146\146\143\143\143\141\141\141\136\136\136"
- "\134\134\134\131\131\131\127\127\127\124\124\124\122\122\122\117\117\117"
- "\115\115\115\112\112\112\107\107\107\105\105\105\102\102\102\100\100\100"
- "\075\075\075\073\073\073\070\070\070\066\066\066\063\063\063\060\060\060"
- "\056\056\056\053\053\053\051\051\051\046\046\046\044\044\044\041\041\041"
- "\037\037\037\034\034\034\032\032\032\027\027\027";
-
-/*
* Index array. For each of the characters 'a'-'y', this table gives the first color
* starting with that character in the xColors table.
*/
@@ -397,13 +375,19 @@ XParseColor(
if (num > (*p)[31]) {
if (((*p)[31] != 8) || num > 100)
return 0;
- q = graymap + 300 - num * 3;
+ num = (num * 255 + 50) / 100;
+ if ((num == 230) || (num == 128)) {
+ /* Those two entries have a deviation i.r.t the table */
+ num--;
+ }
+ num |= (num << 8);
+ colorPtr->red = colorPtr->green = colorPtr->blue = num;
} else {
q = *p + 28 - num * 3;
+ colorPtr->red = ((RED(q) << 8) | RED(q));
+ colorPtr->green = ((GREEN(q) << 8) | GREEN(q));
+ colorPtr->blue = ((BLUE(q) << 8) | BLUE(q));
}
- colorPtr->red = ((RED(q) << 8) | RED(q));
- colorPtr->green = ((GREEN(q) << 8) | GREEN(q));
- colorPtr->blue = ((BLUE(q) << 8) | BLUE(q));
}
colorPtr->pixel = TkpGetPixel(colorPtr);
colorPtr->flags = DoRed|DoGreen|DoBlue;