summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-04-14 17:29:55 (GMT)
committerculler <culler>2019-04-14 17:29:55 (GMT)
commita231332e57a1d87c18d3e76889cc32749851f591 (patch)
treeddc691af62351f94cfc3fd772a6c5c3e167432b9
parenta955dbaac96f1fbdba1e1b4b197703ac45a2e5f0 (diff)
downloadtk-a231332e57a1d87c18d3e76889cc32749851f591.zip
tk-a231332e57a1d87c18d3e76889cc32749851f591.tar.gz
tk-a231332e57a1d87c18d3e76889cc32749851f591.tar.bz2
For Aqua, rename systemTtkBackground to systemWindowBackgroundColor to match
the NSColor name. Document the new colors.
-rw-r--r--doc/colors.n39
-rw-r--r--library/ttk/aquaTheme.tcl4
-rw-r--r--macosx/README9
-rw-r--r--macosx/tkMacOSXColor.c26
4 files changed, 59 insertions, 19 deletions
diff --git a/doc/colors.n b/doc/colors.n
index dc7007b..18f73b7 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -784,9 +784,10 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
-On Mac OS X, the following additional system colors are available
-(note that the actual color values depend on the currently active OS theme,
-and typically many of these will in fact be patterns rather than pure colors):
+On macOS, the following additional system colors are available.
+This first group contains all colors available in the HIToolbox library.
+(Note that in some cases the actual color values may depend on the
+current Appearance.)
.RS
.DS
systemActiveAreaFill
@@ -925,7 +926,39 @@ systemWindowHeaderBackground
systemWindowHeaderInactiveText
.DE
.RE
+.
+The second group of MacOS colors below are based on Apple's "semantic"
+NScolors. On OSX 10.14 (Mojave) and later these colors change value
+when Dark Mode is enabled. However, the change is only observable
+when the Apple window manager is drawing to the screen. So the
+\fBwinfo rgb\fR command will return the color coordinates used in the
+standard Aqua mode, even if Dark Mode has been selected in the system
+preferences. The numbered systemWindowBackgroundColors are used in
+the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a
+contrasting background. Each numbered color constrasts with its
+predecessor.
+.RS
+.DS
+systemControlTextColor
+systemDisabledControlTextColor
+systemLabelColor
+systemSelectedTextBackgroundColor
+systemSelectedTextColor
+systemTextBackgroundColor
+systemTextColor
+systemWindowBackgroundColor
+systemWindowBackgroundColor1
+systemWindowBackgroundColor2
+systemWindowBackgroundColor3
+systemWindowBackgroundColor4
+systemWindowBackgroundColor5
+systemWindowBackgroundColor6
+systemWindowBackgroundColor7
+.DE
+.RE
.TP
+
+
\fBWindows\fR
.
On Windows, the following additional system colors are available
diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl
index 77ece22..4b0740f 100644
--- a/library/ttk/aquaTheme.tcl
+++ b/library/ttk/aquaTheme.tcl
@@ -7,7 +7,7 @@ namespace eval ttk::theme::aqua {
ttk::style configure . \
-font TkDefaultFont \
- -background systemTtkBackground \
+ -background systemWindowBackgroundColor \
-foreground systemLabelColor \
-selectbackground systemHighlight \
-selectforeground systemLabelColor \
@@ -112,7 +112,7 @@ namespace eval ttk::theme::aqua {
ttk::style configure Heading \
-font TkHeadingFont \
-foreground systemTextColor \
- -background systemTtkBackground
+ -background systemWindowBackgroundColor
ttk::style configure Treeview -rowheight 18 \
-background systemTextBackgroundColor \
-foreground systemTextColor \
diff --git a/macosx/README b/macosx/README
index cca90c5..12a7117 100644
--- a/macosx/README
+++ b/macosx/README
@@ -315,10 +315,11 @@ contrasts with the background of the containing object. This means
that the background color of a Ttk widget depends on how deeply it is
nested inside of other widgets that use contrasting backgrounds. To
support this, there are 8 contrasting system colors named
-systemTtkBackground, systemTtkBackground1, ... , systemTtkBackground7.
-The systemTtkBackground color is the standard background for a dialog
-window and the others match the contrasting background colors for
-backgrounds which are nested to the corresponding depth.
+systemWindowBackgroundColor, and systemWindowBackgroundColor1 - 7.
+The systemWindowBackgroundColor is the standard background for a
+dialog window and the others match the contrasting background colors
+used in ttk::notebooks and ttk::labelframes which are nested to the
+corresponding depth.
5. Building Tcl/Tk on macOS
------------------------------
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 0a25490..a368e8c 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -189,14 +189,14 @@ static const struct SystemColorMapEntry systemColorMap[] = {
{ "ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader }, /* 163 */
{ "SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox }, /* 164 */
{ "MetalBackground", HIBackground, kThemeBackgroundMetal }, /* 165 */
- { "TtkBackground", ttkBackground, 0 }, /* 166 */
- { "TtkBackground1", ttkBackground, 1 }, /* 167 */
- { "TtkBackground2", ttkBackground, 2 }, /* 168 */
- { "TtkBackground3", ttkBackground, 3 }, /* 169 */
- { "TtkBackground4", ttkBackground, 4 }, /* 170 */
- { "TtkBackground5", ttkBackground, 5 }, /* 171 */
- { "TtkBackground6", ttkBackground, 6 }, /* 172 */
- { "TtkBackground7", ttkBackground, 7 }, /* 173 */
+ { "WindowBackgroundColor", ttkBackground, 0 }, /* 166 */
+ { "WindowBackgroundColor1", ttkBackground, 1 }, /* 167 */
+ { "WindowBackgroundColor2", ttkBackground, 2 }, /* 168 */
+ { "WindowBackgroundColor3", ttkBackground, 3 }, /* 169 */
+ { "WindowBackgroundColor4", ttkBackground, 4 }, /* 170 */
+ { "WindowBackgroundColor5", ttkBackground, 5 }, /* 171 */
+ { "WindowBackgroundColor6", ttkBackground, 6 }, /* 172 */
+ { "WindowBackgroundColor7", ttkBackground, 7 }, /* 173 */
{ "TextColor", semantic, 0 }, /* 174 */
{ "SelectedTextColor", semantic, 1 }, /* 175 */
{ "LabelColor", semantic, 2 }, /* 176 */
@@ -292,8 +292,14 @@ SetCGColorComponents(
bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:
deviceRGB];
[bgColor getComponents: rgba];
- for (int i=0; i<3; i++) {
- rgba[i] -= entry.value*(8.0/255.0);
+ if (rgba[0] + rgba[1] + rgba[2] < 1.5) {
+ for (int i=0; i<3; i++) {
+ rgba[i] += entry.value*8.0/255.0;
+ }
+ } else {
+ for (int i=0; i<3; i++) {
+ rgba[i] -= entry.value*8.0/255.0;
+ }
}
break;
case semantic: