bsnes icon indicating copy to clipboard operation
bsnes copied to clipboard

hiro: bsnes should use a dark theme on platforms that support it

Open Screwtapello opened this issue 4 years ago • 3 comments

Some platforms only support a single platform-wide theme, some platforms allow the entire user-interface to switch between "dark mode" and "light mode", but some platforms (in particular, macOS and GTK+3) support a dark theme on a per-application basis. On such platforms, it's typically a convention that the dark theme is used by media applications (video players, image viewers, etc.).

bsnes fits fairly comfortably in that category, so it's appropriate that it should use a dark theme where available.

I think we should add an "ask for dark theme" API to hiro, and use it in bsnes (and maybe higan), so hiro can be shared with other applications where a dark theme wouldn't be appropriate. Copy/pasted from my comment on #117:

Since the two platforms that support a per-application dark theme both use a procedural API, I think that would be the best model for hiro to adopt:

  • Application::setPreferDarkTheme(true) calls pApplication::setPreferDarkTheme
  • on GTK+3, we do the gtk_settings dance as described in #117
  • on macOS, we do the NSAppearance dance as described in the AppKit docs
  • on Windows and Qt, we have a do-nothing stub
  • When the situation changes, and Windows and/or Qt do something that makes this API inappropriate, we aggressively refactor it with our new understanding of the problem space

Just setting a flag in the Application class and having the GTK+3 backend query it would be a less-invasive change, but I fear that would obscure the link between the code that sets the flag and the code that reads it — somebody might try to set it at runtime, or on a different platform, and wonder why nothing happens. At least if there's a direct call, somebody looking at (say) the Windows backend can see that the function is an empty stub, rather than not finding anything and wondering if the functionality is magically supplied by some other means.

Screwtapello avatar Jan 08 '21 12:01 Screwtapello

Forcing the theme does not play well with people who set the theme themselves, I would advise against this. It should be a user configuration, not a program configuration.

orbea avatar Jan 08 '21 16:01 orbea

If you set GTK+3 to use a specific theme, that theme is supposed to include regular and dark variants of every widget. If the theme is already a dark theme, the variants probably look the same, but they can be quite different. If you look at the implementation in #117, you'll see it's not forcing a specific theme, it's just asking for the dark variant of whatever theme the user has chosen.

Screwtapello avatar Jan 08 '21 23:01 Screwtapello

Apologies for misunderstanding, I assumed it was how some other programs force a specific theme. If its just requesting a dark/light variant of the user's theme that is already provided that is fine.

orbea avatar Jan 09 '21 02:01 orbea