diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tkUnixColor.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index a455118..9474c95 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -136,6 +136,18 @@ TkpGetColor( if (*name != '#') { XColor screen; + if (((*name - 'A') & 0xdf) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { + const char *p = tkWebColors[((*name - 'A') & 0x1f)]; + if (p) { + const char *q = name; + while (!((*p - *(++q)) & 0xdf)) { + if (!*p++) { + name = p; + goto gotWebColor; + } + } + } + } if (strlen(name) > 99) { /* Don't bother to parse this. [Bug 2809525]*/ return (TkColor *) NULL; @@ -155,6 +167,7 @@ TkpGetColor( FindClosestColor(tkwin, &screen, &color); } } else { + gotWebColor: if (TkParseColor(display, colormap, name, &color) == 0) { return NULL; } |