diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-09-28 10:42:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-09-28 10:42:31 (GMT) |
commit | 909217df3c0c2f0f162731db5d8cd8f36c00c6e5 (patch) | |
tree | ac49bac7b0a5b38a5c7103eb9cfe0c6a7caf8afc /unix | |
parent | 0e0d9b0e10ba2a3152820bae02018b0cd17fcb42 (diff) | |
parent | ca628a3dcc069bbebb21f385893a43cca232ae7d (diff) | |
download | tk-909217df3c0c2f0f162731db5d8cd8f36c00c6e5.zip tk-909217df3c0c2f0f162731db5d8cd8f36c00c6e5.tar.gz tk-909217df3c0c2f0f162731db5d8cd8f36c00c6e5.tar.bz2 |
Add 8 colors to the supported color list (aqua, crimson, fuchsia, indigo, lime, olive, silver and teal), part of TIP #403
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; } |