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

Use Windows settings to determine titlebar color #1933

Closed
wants to merge 2 commits into from
Closed

Conversation

Silarn
Copy link
Member

@Silarn Silarn commented Nov 29, 2023

It would be good to test this on Windows 10.

@Silarn Silarn requested review from Holt59 and Al12rs November 29, 2023 06:10
Holt59
Holt59 previously approved these changes Nov 29, 2023
@Silarn Silarn marked this pull request as draft November 29, 2023 08:56
@Silarn
Copy link
Member Author

Silarn commented Nov 29, 2023

Turns out this only applies to the main window but not any other QWidget window. I'll have to see if there's an efficient way to apply this to all windows.

@Holt59
Copy link
Member

Holt59 commented Nov 29, 2023

Turns out this only applies to the main window but not any other QWidget window. I'll have to see if there's an efficient way to apply this to all windows.

You probably should use Qt for this, I think you can set a palette for the title bar, see e.g. https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5

- Fusion already implements light/dark mode switching, the original 'windowsvista' style does not
- Applying the stylesheet on top of Fusion colors the titlebar based on the OS setting
@Silarn Silarn marked this pull request as ready for review November 29, 2023 16:00
@Silarn
Copy link
Member Author

Silarn commented Nov 29, 2023

Turns out the 'fusion' style is what already implements titlebar color changing based on OS settings. Just setting that as the 'base' application theme does what we want.

@Holt59
Copy link
Member

Holt59 commented Dec 4, 2023

This sets fusion as the default style for MO2, so that's probably not what we want. It works if you have another theme selected that overrides basically everything, but not if you use the default Qt theme.

@Silarn
Copy link
Member Author

Silarn commented Dec 4, 2023

The difference is fusion is the default style instead of the windowsvista style. They are both core qt styles but only fusion supports automatic dark/light mode switching including the titlebar.

As far as I can tell this is the only way to support it barring extending our own base style which reimplements the fusion titlebar code.

Fusion is designed to be their modern theme which utilizes the more modern OS style features.

@Holt59
Copy link
Member

Holt59 commented Dec 4, 2023

The difference is fusion is the default style instead of the windowsvista style. They are both core qt styles but only fusion supports automatic dark/light mode switching including the titlebar.

The windowsvista style is Windows-like and has been the default one probably forever. Changing it to fusion makes a huge difference for users that do not use a dark theme, and can also have impacts on other styles since these will "derive" from fusion instead of vista.

As far as I can tell this is the only way to support it barring extending our own base style which reimplements the fusion titlebar code.

That's probably what we should do, but the bigger issue is that you cannot link the stylesheet to the color theme, so you can end-up with a dark theme (e.g. VS Dark), with a light title bar is user has a light color theme in Windows.

@AnyOldName3
Copy link
Member

Dolphin Emulator decided that Fusion was a big enough change that they bit the bullet and manually implemented dark mode on top of QWindowsVistaStyle. It's discussed on their blog: https://dolphin-emu.org/blog/2023/11/25/dolphin-progress-report-august-september-and-october-2023/

@Silarn
Copy link
Member Author

Silarn commented Dec 4, 2023

I actually have tried the existing styles with this change and the visible differences are fairly slight since most of these themes do actually touch most of the UI. In fact, it seems the issue with the weird selection box coloring is fixed, although a couple of selection boxes are now light colored even with dark themes. (The instance creation options.) Though I still find this preferable to the weird buggy text coloring in 2.5.0.

Now, it's true that the titlebar will use the windows light/dark setting regardless of what theme is selected but having it not do that while supporting a dark titlebar when appropriate means we're going to have to add a way to indicate if a stylesheet is light or not and tell the custom Qt style which mode to use.

All that being said, I don't think themes would need much updating and several of the primary theme authors are still pretty active. So I don't see why we can't just update the existing styles for fusion. At that point it's really just 'oh no, i have a light theme selected but dark mode set in Windows and my titlebar is dark'. Which seems like a fairly minor problem. (At least, no worse and probably slightly better than what we have right now.)

@Silarn Silarn marked this pull request as draft December 28, 2023 21:07
@Silarn
Copy link
Member Author

Silarn commented May 20, 2024

This is likely obsolete with the latest Qt changes

@Silarn Silarn closed this May 20, 2024
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.

4 participants