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

feat: auto dark reader mode for Windows #1985

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

atauzki
Copy link
Collaborator

@atauzki atauzki commented Nov 23, 2024

Not a proper way to do that after qt6.8 due to the new API, but it just works on 6.7 or older.

and I'm not sure whether the dark mode's switch should be considered into auto mode in other platforms.

Copy link

sonarcloud bot commented Nov 23, 2024

@shenlebantongying
Copy link
Collaborator

shenlebantongying commented Nov 23, 2024

Change looks fine, now it syncs with UI's dark mode.

The UI auto dark mode and QStyleHints::colorScheme doesn't work is because they are disabled here (Qt's auto dark mode conflicts with the existing dark theme, and it has various bugs at the release of Qt6.7.0).

https://github.com/xiaoyifang/goldendict-ng/blame/5406b3022a4af8b2ff2c6dcd814b8a986dc720ad/src/main.cc#L346

I put a macOS version demo which shows what optimal “auto” looks like #1907 (Also works on some Linux environments.)

@shenlebantongying shenlebantongying changed the title fix: auto darkreader mode not working on Windows feat: auto dark reader mode for Windows Nov 23, 2024
@shenlebantongying shenlebantongying merged commit 1fb1c5c into xiaoyifang:staged Nov 23, 2024
8 checks passed
@shenlebantongying
Copy link
Collaborator

and I'm not sure whether the dark mode's switch should be considered into auto mode in other platforms.

The other 2 platforms uses native themes (do nothing about UI at all). So there is no dark UI mode switch 😅

@atauzki
Copy link
Collaborator Author

atauzki commented Nov 23, 2024

and I'm not sure whether the dark mode's switch should be considered into auto mode in other platforms.

The other 2 platforms uses native themes (do nothing about UI at all). So there is no dark UI mode switch 😅

I just tested on KDE neon and it failed to switch the dark theme for the qt 6.8 failed to detect the color scheme, returns Qt::ColorScheme::Unknown.

image

@shenlebantongying
Copy link
Collaborator

shenlebantongying commented Nov 23, 2024

@shenlebantongying
Copy link
Collaborator

QT_QPA_PLATFORMTHEME=xdgdesktopportal

and

ensure no qt-style.css exists.

Then we can get

123.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants