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 | ccdd8d3ab00162ae1628413134fbda50e17212e9 (patch) | |
tree | ac49bac7b0a5b38a5c7103eb9cfe0c6a7caf8afc /unix | |
parent | 52f37b7b2bdb8369bd206d66ad5b4c499daebf7c (diff) | |
parent | 35c5d43f01e2ff6e8cc9f7585adceb7bcbbbbcf9 (diff) | |
download | tk-ccdd8d3ab00162ae1628413134fbda50e17212e9.zip tk-ccdd8d3ab00162ae1628413134fbda50e17212e9.tar.gz tk-ccdd8d3ab00162ae1628413134fbda50e17212e9.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; } |