Repository navigation
Add a dark mode toggle - #47
Open
ascensionra wants to merge 1 commit into
Open
ascensionra wants to merge 1 commit into
ascensionra wants to merge 1 commit into
Conversation
Short Circuit only ever rendered with the OS's light/native widget style. Several widgets also hardcode light-theme-only colors (status message text, the four security-priority spinbox backgrounds, and the path-table row highlighting), so simply applying a dark QApplication stylesheet on top would leave those specific widgets unreadable (e.g. black status text on a dark background). This adds a View > Dark Mode checkable menu action that applies a QSS dark theme app-wide, persisted via QSettings like the other preferences. On Windows, Qt style sheets don't fully restyle some native-style controls (combo box/spin box arrows, checkboxes), so enabling dark mode also switches the base QStyle to Fusion, which is stylesheet-driven, and restores the original style when toggled off. The hardcoded-color widgets are made theme-aware individually rather than through the global stylesheet: a widget's own setStyleSheet() call takes precedence over an ancestor/application stylesheet for the same widget in Qt's cascade, regardless of selector specificity, so the four priority spinboxes (whose colors are set directly in the generated gui_main.py from the .ui file) needed explicit light/dark variants rather than relying on inheritance. The path-table row colors are intentionally fixed light pastels for security-class coding in both themes, so their text is now pinned to black instead of inheriting the theme's (light) default foreground color.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a View > Dark Mode checkable menu action that switches the whole app to a dark Qt stylesheet, persisted across restarts via
QSettingsalongside the other preferences.Context
The app only ever rendered in the OS's light/native widget style. A few widgets also hardcode light-theme colors directly (status message text, the four security-priority spinbox backgrounds, and the path-table row highlighting), so a naive global stylesheet would leave those specific widgets unreadable (e.g. black status text on a dark background).
Approach
src/shortcircuit/view/theme.pyholds the dark QSS and anapply_theme(app, dark)helper. It's hand-written (not uic-generated), unlike the otherview/modules.QStyleto Fusion, which is fully stylesheet-driven, and restores the original style when toggled back off. The original style name is stashed as a dynamic Qt property on theQApplicationobject (app.setProperty(...)) rather than module-level Python state, so it survives across calls without aglobal.setStyleSheet()call takes precedence over an ancestor/application stylesheet for the same widget in Qt's cascade, regardless of selector specificity:_label_message(status/path messages) picks theme-appropriate green/red/neutral instead of hardcoded green/red/black.gui_main.py) get explicit light/dark variants applied on toggle..uiregeneration needed.Trade-offs
yapfwould also reformat elsewhere inapp.py(e.g.MappersDialog.__init__), since they're pre-existing and unrelated to this change — kept the diff scoped to dark mode.Testing
yapf --diffandpylint(project configs) are clean on both changed files (10.00/10 on the new module).requirements.txt) headlessly, toggled dark mode at runtime, and ran an actual pathfind (Jita → Amarr) to populate the results table — confirmed menu, buttons, inputs, table, status bar, and the three previously-hardcoded-color widgets all render correctly and stay legible in both themes.build_win_installer.bat/ PyInstaller spec to confirm the change doesn't break packaging.Risks
Low — additive UI feature behind an opt-in toggle, defaults to off, no changes to pathfinding/networking logic.