Tk Source Code

View Ticket
Login
Ticket UUID: 042da6013e4af3e4c0eab98161ce50b11b705b42
Title: Pendulum demo text not visible under dark mode
Type: Bug Version: core-8-6-branch
Submitter: chrstphrchvz Created on: 2025-11-24 04:39:33
Subsystem: 76. Widget Tour Assigned To: chrstphrchvz
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-28 19:12:22
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-28 19:12:22
Description:

The pendulum widget demo specifies the background color of the canvases to white, but leaves the canvas text items set to the default foreground color (which under dark mode is white). As a result, the text “Click to Adjust Bob Start Position” and phase space graph axis labels are not visible under dark mode.

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-28 19:12:22:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [d005489a], [02bf07d1], and [e7514243].


serhiy.storchaka added on 2026-10-26 13:15:58:

Proposed fix in branch demo-colors-dark-mode [72d8eb4751]: the three text items get a fill of their own, so they no longer depend on a default foreground which a dark appearance inverts.

This is the conservative half of the question Jan raised: the white background stays, which is what the phase space graph needs for the reason Christopher gave, and only the items which had no colour of their own are given one. Dropping -background white from the pendulum canvas is still open, and would mean giving the rod and the pivot colours of their own as well.

The same commit does the equivalent for the widget demo's index, whose link colours were chosen for a white text widget and are unreadable on a dark one. It picks between two sets by the weighting tk_setPalette uses to choose a foreground, rather than assuming either.

The default ink is black, and on X11 it is the literal #000000, so nothing changes there. On Aqua and Windows it is NORMAL_FG, which follows the system, and that is where the items turned white against the white canvas.


chrstphrchvz added on 2025-11-24 19:44:35:

Maybe that is possible for the pendulum system canvas if the rod color is set to something other than black. But for the phase space graph canvas it’s easier to leave the background as white since it uses graphed lines which fade from black to white.


jan.nijtmans added on 2025-11-24 08:37:02:

Would it also be possible not to specify the background color to white any more, at least for 9.0+?