summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixColor.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-09-28 10:42:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-09-28 10:42:31 (GMT)
commitccdd8d3ab00162ae1628413134fbda50e17212e9 (patch)
treeac49bac7b0a5b38a5c7103eb9cfe0c6a7caf8afc /unix/tkUnixColor.c
parent52f37b7b2bdb8369bd206d66ad5b4c499daebf7c (diff)
parent35c5d43f01e2ff6e8cc9f7585adceb7bcbbbbcf9 (diff)
downloadtk-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/tkUnixColor.c')
-rw-r--r--unix/tkUnixColor.c13
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;
}