summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXColor.c
diff options
context:
space:
mode:
authorculler <culler>2019-03-11 16:18:42 (GMT)
committerculler <culler>2019-03-11 16:18:42 (GMT)
commitcc0838e96eb2896404e634bea95769c4fd7ebd76 (patch)
tree4861c70a0e7dc31462c78fbcd6f7b6f46bdf3806 /macosx/tkMacOSXColor.c
parentecdf944613bc935541cc765dbfb03b93ab8d389d (diff)
downloadtk-cc0838e96eb2896404e634bea95769c4fd7ebd76.zip
tk-cc0838e96eb2896404e634bea95769c4fd7ebd76.tar.gz
tk-cc0838e96eb2896404e634bea95769c4fd7ebd76.tar.bz2
Add colors systemControlTextColor and systemDisabledControlTextColor and
use them for ttk buttons. These colors adapt to Dark Mode.
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r--macosx/tkMacOSXColor.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index fd2326c..985b09b 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -197,10 +197,12 @@ static const struct SystemColorMapEntry systemColorMap[] = {
{ "TtkBackground5", ttkBackground, 5 }, /* 171 */
{ "TtkBackground6", ttkBackground, 6 }, /* 172 */
{ "TtkBackground7", ttkBackground, 7 }, /* 173 */
- { "TtkForeground", ttkForeground, 0 }, /* 174 */
+ { "LabelColor", ttkForeground, 0 }, /* 174 */
+ { "ControlTextColor", ttkForeground, 1 }, /* 175 */
+ { "DisabledControlTextColor", ttkForeground, 2 }, /* 176 */
{ NULL, 0, 0 }
};
-#define MAX_PIXELCODE 174
+#define MAX_PIXELCODE 176
/*
*----------------------------------------------------------------------
@@ -282,8 +284,20 @@ SetCGColorComponents(
}
break;
case ttkForeground:
- fgColor = [[NSColor labelColor] colorUsingColorSpace:
- [NSColorSpace deviceRGBColorSpace]];
+ switch (entry.value) {
+ case 1:
+ fgColor = [[NSColor controlTextColor] colorUsingColorSpace:
+ [NSColorSpace deviceRGBColorSpace]];
+ break;
+ case 2:
+ fgColor = [[NSColor disabledControlTextColor] colorUsingColorSpace:
+ [NSColorSpace deviceRGBColorSpace]];
+ break;
+ default:
+ fgColor = [[NSColor labelColor] colorUsingColorSpace:
+ [NSColorSpace deviceRGBColorSpace]];
+ break;
+ }
[fgColor getComponents: rgba];
break;
case clearColor: