| Ticket UUID: | 49c151a3e6a5fea02fab8d15d7d17fa1c6fa487d | |||
| Title: | Aqua: fix foreground color of disabled notebook tab in background | |||
| Type: | Patch | Version: | 8.6.12 | |
| Submitter: | chrstphrchvz | Created on: | 2022-08-08 17:52:53 | |
| Subsystem: | 88. Themed Tk | Assigned To: | marc_culler | |
| Priority: | 5 Medium | Severity: | Cosmetic | |
| Status: | Open | Last Modified: | 2022-10-29 02:05:04 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
When using the Aqua ttk theme, the foreground text color of a disabled tab is incorrect for background toplevels (regardless of light/dark appearance). As stated by documentation for ttk::style map the order of pairs is important. Putting the pair for disabled state before the one for background state avoids the issue:
--- library/ttk/aquaTheme.tcl.orig
+++ library/ttk/aquaTheme.tcl
@@ -86,8 +86,8 @@ namespace eval ttk::theme::aqua {
ttk::style configure TNotebook.Tab -foreground systemControlTextColor
ttk::style map TNotebook.Tab \
-foreground {
+ disabled systemDisabledControlTextColor
background systemControlTextColor
- disabled systemDisabledControlTextColor
selected systemSelectedTabTextColor}
# Treeview:
However I’m not certain this is the correct approach. I notice that no other theme in core Tk sets ttk::style map TNotebook.Tab -foreground. Before: After: | |||
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2022-10-29 02:05:04:
Sorry, I haven't paid attention to this for quite a while. I do not have a strong opinion about what the "correct" approach would be to inventing an appropriate appearance for a disabled tab, given that there is no such thing in Apple's world. On the other hand, the question of how the label color of a notebook tab should change when the window loses focus does not seem to have been resolved. Apple does this differently depending on the OS version. Presumably we want to match what they do. But I don't think we would accomplish that by merging this branch. (I could be wrong about that, however.) jan.nijtmans added on 2022-10-28 22:25:13: @marc_culler, is [94dcee5089] ready to be merged? chrstphrchvz added on 2022-08-30 22:39:40: I should also note that the System Preferences screenshot I provided is from 10.15 Catalina; I would think 10.14 Mojave looks similar). But I notice that on 12 Monterey (and so probably also 11 Big Sur and 13 Ventura) the appearance of native tabs (including the foreground color) is the same regardless of whether an app is active, so that is one more thing to keep in mind. chrstphrchvz added on 2022-08-30 22:31:11: To correct myself, it’s not really semantic, but I would say the important part controlling it is here in tkMacOSXColor.c:
} else if (entry->index == selectedTabTextIndex) {
if (OSVersion > 100600 && OSVersion < 110000) {
color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
} else {
color = [[NSColor textColor] colorUsingColorSpace:sRGB];
}
chrstphrchvz added on 2022-08-30 22:23:12: I will have a look at the proposal later, but I can say right away that systemSelectedTabTextColor is a semantic color, see tkMacOSXColor.c:
/* Color to use for notebook tab label text -- depends on OS version. */
{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL },
It is mentioned in macosx/README, but after the list of all of the other semantic colors: One additional color, systemSelectedTabTextColor, does not exist in macOS but is used by Tk to match the different colors used for Notebook tab text in different OS versions. fvogel added on 2022-08-30 20:15:53: OK, thanks. I have committed your poposed patch as [94dcee5089]. Regarding the foreground color that a selected tab should have in dark mode, I believe systemSelectedTabTextColor is currently used with the aqua theme when the widget is not in the background, and systemControlTextColor when it is in the background (the first matching pair in the map is used). I understand systemControlTextColor to be a so-called semantic color (a color that changes depending on normal or dark mode), so it should be the right color in both normal and dark modes. I'm not sure systemSelectedTabTextColor is a semantic color, it seems it isn't (from tk/macosx/README section 4). Do you think the following could do the job?
ttk::style map TNotebook.Tab \
-foreground {
disabled systemDisabledControlTextColor
{selected !background} systemSelectedTabTextColor
{selected background} systemSelectedTextBackgroundColor
background systemControlTextColor
}
chrstphrchvz added on 2022-08-27 22:33:59:
I haven’t checked the Windows themes, but all of the others in core Tk (default, classic, alt, clam) seem to only change the label text foreground color to indicate a disable tab, and not change the tab itself.This is not obvious for me. Where do you see this in the code? The notebook tab foreground color for the default, classic, alt, and clam themes is inherited from ttk::style map "." -foreground [list disabled $colors(-disabledfg)]; and the background colors are set by ttk::style configure TNotebook.Tab … -background … and ttk::style map TNotebook.Tab … -background … with no specific setting for the disabled state. Besides, reading the ttk::widget man page for the "background" state I wonder if the Mac could have to display tabs in state {disabled background} differently than in state {disabled !background} ? I don’t think disabled tabs should have a different appearance for background state. I do notice that the aqua theme should have -foreground {selected background} be different than -foreground {selected !background} in dark mode, though I’m not aware which system color to use for this. Contrast this screenshot of Tk with one of System Preferences:
fvogel added on 2022-08-22 20:29:51: Revisiting this, I suddenly realize I don't understand this sentence from Christopher: "I haven’t checked the Windows themes, but all of the others in core Tk (default, classic, alt, clam) seem to only change the label text foreground color to indicate a disable tab, and not change the tab itself.". This is not obvious for me. Where do you see this in the code? Besides, reading the ttk::widget man page for the "background" state I wonder if the Mac could have to display tabs in state {disabled background} differently than in state {disabled !background} ? If so we should probably refine the fix with something like:
ttk::style map TNotebook.Tab \
-foreground {
{disabled background} someAdequateColorHere
{disabled !background} systemDisabledControlTextColor
background systemControlTextColor
selected systemSelectedTabTextColor}
What do you think? What should someAdequateColorHere be? fvogel added on 2022-08-19 13:35:47: Based on the below discussion, is there anything that should prevent us from committing the proposed change then? chrstphrchvz added on 2022-08-09 17:13:39:
How do other themes that do not change the foreground color represent the disabled state of a tab? Is there an approach that would be feasible on the mac (and in particular with HITheme)? I haven’t checked the Windows themes, but all of the others in core Tk (default, classic, alt, clam) seem to only change the label text foreground color to indicate a disable tab, and not change the tab itself. marc_culler (claiming to be Marc Culler) added on 2022-08-09 16:36:03: I see. Also, I believe that the corresponding "native" widget does not support the concept of a disabled tab, so we are on our own to decide what foreground color to use for a disabled tab. If systemDisabledControlTextColor is appropriate, and if for some mysterious reason changing the order fixes the problem then I am all for it. How do other themes that do not change the foreground color represent the disabled state of a tab? Is there an approach that would be feasible on the mac (and in particular with HITheme)? chrstphrchvz added on 2022-08-09 15:26:40: I confirmed this on macOS 10.15 and 12. But I don’t see how this issue is affected by macOS version, the issue is in the tab label text that gets drawn after the tab itself. marc_culler (claiming to be Marc Culler) added on 2022-08-09 14:06:51: Unfortunately Apple seems to change the appearance of the notebook tabs with every OS release. Which version of macOS were you testing on? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki
