Emulator Issues #13146open
Text is unreadable in CodeViewWidget when using dark mode user style
What's the problem? Describe what went wrong.
When using a custom user style to provide dark mode, the background colors for the
QTableWidgetItems are still set based on
qApp->palette() and not the stylesheet.
If the system theme is light (e.g. dark mode stylesheet on Windows) then the background colors do not contrast with the text color and it becomes unreadable.
What steps will reproduce the problem?
- Set up Dolphin on a system with a light theme (Windows or Linux with a bright Qt style should work).
- Install and configure a dark user style, e.g. Lightsout.
- Start a game with debugging symbols, and open the debug view.
- Any code with associated symbols is unreadable in the Code tab of the debug view.
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Yes. As of writing the latest version is 5.0-18219.
Is the issue present in the latest stable version?
No. Latest stable version is 5.0.
If the issue isn't present in the latest stable version, which is the first broken version?
git-blame shows that the line I believe to be the cause of the issue was introduced in commit
d14f6e9, which was released as version 5.0-7520.
What are your PC specifications?
I am using a Lenovo X1 Yoga 3rd Gen:
- CPU: Intel Core i7-8550U (1.8 GHz, 4c/8t)
- GPU: Intel UHD Graphics 620
- RAM: 16 GB LPDDR3-2133
- OS: Windows 10 Education 22H2 19045
Is there anything else that can help developers narrow down the issue?
I've linked the code that I believe to be the cause above. Essentially, the widget detects dark themes using the
QPalette::Base color, which works for system dark themes but does not account for stylesheets.
I would open a PR for this, but because there's no way to programmatically query colors set by stylesheets (short of manually parsing the stylesheet) I'm not sure how this could be best handled.
Here are some ideas for solving this:
- Add a config entry to specify if stylesheets are light or dark themes. This is probably the easiest to implement.
- Add a custom QSS rule or some other specifier within the stylesheet to denote light/dark themes. This would be more user-friendly at the expense of requiring light parsing and theme updates.
- Allow customization of the symbol colors (either via config or QSS). This would allow the user the most control, but would require the most development work and potentially require theme updates.
No data to display