Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI color issue after switching between light/dark mode on macOS #57

Closed
kailiu42 opened this issue Oct 14, 2023 · 7 comments
Closed

UI color issue after switching between light/dark mode on macOS #57

kailiu42 opened this issue Oct 14, 2023 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kailiu42
Copy link

kailiu42 commented Oct 14, 2023

Some UI element remains dark background after the OS switched from dark to light mode, make the text unreadable and the UI look strange. Would you please take a look?

Snipaste-20231014-091437 Snipaste-20231014-091448
@lighterowl lighterowl self-assigned this Oct 14, 2023
@lighterowl lighterowl added the bug Something isn't working label Oct 14, 2023
@lighterowl
Copy link
Owner

Thanks, it can't be a coincidence that it's every 2nd row.

@wayward-turnip
Copy link

wayward-turnip commented Oct 19, 2023

This was reported here, and your fix @Xavery would also fix the issue on the upstream project.
As described here, it has something to do with when day/night mode switch — the app does not notice.
transmission-remote-gui#1366

          Also in Dark Mode, hyperlink color is almost unreadable at night.

Screen Shot 2021-03-17 at 9 32 49 PM

Originally posted by @wayward-turnip in transmission-remote-gui#1366 (comment)

@lighterowl
Copy link
Owner

lighterowl commented Oct 19, 2023

The colour used to draw even-numbered rows is called AlternateColor in Lazarus' TGrid classes, and transgui sets it for (almost) all grids used in the program inside TMainForm.FormCreate :

gTorrents.AlternateColor:=FAlterColor;
lvPeers.AlternateColor:=FAlterColor;
lvTrackers.AlternateColor:=FAlterColor;
gStats.AlternateColor:=FAlterColor;

The problem is that TMainForm.FormCreate is only called once so this value remains the same throughout the whole program, without taking into account any potential dark/light theme changes.

There is a solution available which gets a "theme changed" notification straight from the OS so it sounds like it's going to be possible to set those colours to new theme-appropriate values.

@lighterowl
Copy link
Owner

Dark/light theme transitions should be now fixed. Hyperlinks now use a lighter shade of blue in dark mode which is much more readable :
foo

The latest build from master incorporates these changes : https://github.com/xavery/transgui/suites/17484835100/artifacts/999179257

@kailiu42
Copy link
Author

The torrent list view is OK with the latest build now. However the downloaded progress bar in the general panel still has problem.

The bar after switched from dark to light:
Snipaste-20231022-091456

The bar after restarted transgui, which should be the correct color:
Snipaste-20231022-091516

@lighterowl
Copy link
Owner

lighterowl commented Oct 22, 2023

Thanks @kailiu42 , great catch.

The progress bar uses a custom drawing procedure which needs the data from the currently selected torrent. This means that the colour change will be a bit delayed to the app's theme change but will happen eventually (depending on your refresh interval) :

output2.mp4

I'm sure there's a way to call this procedure from the theme change callback but I kept getting weird crashes that I couldn't figure out.

These changes are available in https://github.com/xavery/transgui/suites/17499778981/artifacts/999844573.

@kailiu42
Copy link
Author

It works now. Thanks a lot @Xavery for your great help!

@lighterowl lighterowl added this to the 5.18.4 milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants