-
Notifications
You must be signed in to change notification settings - Fork 381
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
feat: Theme manager #587
base: main
Are you sure you want to change the base?
feat: Theme manager #587
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting theme management and switching under control will be good to have, thanks. Unfortunately, currently, I'm unsure how to test this? I'd like to see the stock themes moved to the theme file format.
It also seems you are defining your own theming file format. Is there a reason/advantage to doing this rather than using QSS files (Qt Style Sheets, Qt's file format for theming)?
# the following signal emits when system theme (Dark, Light) changes (Not accent color). | ||
QApplication.styleHints().colorSchemeChanged.connect(update_palette) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see this file moved into a ThemeManager class, rather than having this executed on import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or should i just move this line into Ui_MainWindow
?
this theme manager will be useful once the settings window and theme settings in it is implemented. until then, we'll need to manually edit the
if we use QSS, it will bring lot of customization options. but we would also need to ensure that every widget respects those customizations. to keep theme management as simple as possible, theme manager uses thank you so much for the reviews ❤️. i'll update and ping you for rereview. |
I have been trying it out and seems to work well, however whenever I open TS the Appearance role disappears from the config and I have to add it again before starting TS for the Theme to work |
it's because opening library clears all settings. #622 |
Could this be updated now that #622 is merged to make is easier to review? |
main_window.py: put driver to application property and update theme palette. qt_logger.py: contains a logger which will be used in ui related codes. theme.py: New theme management system. test_theme.py: tests for theme management system.
Co-authored-by: yed <yedpodtrzitko@users.noreply.github.com>
58381aa
to
fc82847
Compare
Theme manager to the application, enabling support for customizable themes.
this theme manager will be easily accessible once the settings window and theme settings in it are implemented. until then, we'll need to manually edit the
config.ini
file to set theme settings.to test:
add new group and values as below in your
config.ini
:DarkMode=auto
will set the dark mode to system. available values:true
,false
andauto
set up theme files:
the theme files should be like below (in
.ini
format):ColorRoleName
is the name of the color role (e.g. Window, Button, etc.)ColorGroupName
is the name of the color group (e.g. Active, Inactive or Disabled)Color
is the color value in the QColor supported format (e.g. #RRGGBB, blue, etc.)sample theme.ini i made this beautiful theme 😎
available roles
WindowText
Button
Light
Midlight
Dark
Mid
Text
BrightText
ButtonText
Base
Window
Shadow
Highlight
HighlightedText
Link
LinkVisited
AlternateBase
NoRole
ToolTipBase
ToolTipText
PlaceholderText
Accent
not sure ifQPalette
and/or widgets gets accent from system, even if this is setavailable groups
Active
: if focusedInactive
: normalDisabled
: if disabledtnx ❤️