Tk Source Code

View Ticket
Login
Ticket UUID: 3eb2a8df6438d2e0df3ea3438a23fc13e72d7408
Title: Custom treeview header -background unused for aqua Ttk theme
Type: Bug Version: 8.6.10
Submitter: chrstphrchvz Created on: 2020-07-21 17:33:57
Subsystem: 88. Themed Tk Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2020-11-15 13:58:14
Resolution: None Closed By: nobody
    Closed on:
Description:

The header background of ttk::treeview widgets is configurable using the Heading style:

::ttk::style configure Heading -background $color

and this setting is effective for Ttk themes such as default:

But the aqua Ttk theme (used when Tk Aqua is started) does not use this setting, at least on macOS 10.9 and later. Depending on whether the toplevel is using dark mode, either DrawListHeader() or DrawDarkListHeader() (ttkMacOSXTheme.c) is used. DrawListHeader() draws the header background using hardcoded colors: #EEEEEE if the toplevel is active, otherwise #F6F6F6:

DrawDarkListHeader() doesn't draw a background fill color at all, so header background is effectively the treeview -fieldbackground color (which is systemTextBackgroundColor by default):

User Comments: fvogel added on 2020-11-15 13:58:14:

TIP #584 is now merged in main, and could help since it provides new introspection capabilities in ttk.


fvogel added on 2020-08-17 06:55:08:

X-ref: [b46642fe3b], similar discussion.


marc_culler (claiming to be Marc Culler) added on 2020-08-16 22:23:37:
I would say that the bug here is that the -fieldbackground color should not
be used in Dark Mode.  The native equivalent, which I think is NSTableView,
does not offer a choice of header color, so Ttk shouldn't either.

chrstphrchvz added on 2020-07-21 17:38:18:

I am not very familiar with how Ttk C internals work, so it is not immediately apparent to me how this can be addressed. Maybe someone more familiar with it can give this a try.