Skip to content

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

Open
@Screwtapello

Description

@Screwtapello

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 Prefer dark theme on GTK 3 #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions