slint icon indicating copy to clipboard operation
slint copied to clipboard

Dark/Light mode detection on Linux with winit is unreliable

Open qarmin opened this issue 1 year ago • 6 comments

As a fan of the dark mode, the default bright mode is not very friendly to my eyes.

It would be useful to add a dark background

Screenshot from 2024-01-21 14-53-14

Edit: While the contrast issue is fixed, the issue that remains here is that with winit we don't get notified when the theme changes on Linux. See also https://github.com/rust-windowing/winit/issues/1549

qarmin avatar Jan 21 '24 14:01 qarmin

Odd, for me the toolbar with the pick mode button and the combobox looks okay (macOS). But the area around the preview'ed UI is unconditionally white:

background: root.experimental ? Colors.pink : Colors.white ;

I guess that should be Palette.background instead? @FloVanGH : Or should it be another one of the alternate backgrounds?

tronical avatar Jan 21 '24 16:01 tronical

@tronical yes it's right it should be Palette.background

FloVanGH avatar Jan 22 '24 08:01 FloVanGH

I would love to use a checkerboard pattern or something that contrasts with both light and dark backgrounds. We would have tiled images for that.

hunger avatar Jan 22 '24 08:01 hunger

I did not use any default background color as that is very likely used in the embedded UI as well, making it hard to see where the "outer" UI stops and the "inner" UI a user wants to design starts.

hunger avatar Jan 25 '24 13:01 hunger

We just discussed this briefly. While for the preview it would make sense to use Palette.alternate-background, the real issue seems to be that on Linux with winit the detection of the theme doesn't work reliably. Strictly speaking, this regressed with commit a45421b425748d459f8916e730f37b64aed9dfbe .

tronical avatar Jan 25 '24 14:01 tronical