-
Notifications
You must be signed in to change notification settings - Fork 2k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live theme changes #1497
Live theme changes #1497
Conversation
Oh, and one other thing: The background of the main window's menu bar's menus remain white when switching to night mode and I don't know why. If anyone had an idea why that might be, I'd appreciate it. |
- drop _light_palette, as default_palette serves the same purpose - save default platform theme, and restore it when switching away from nightmode - update macOS light/dark mode on theme switch - fix unreadable menus on Windows
This is the easy part - CSS styling that uses standard_css or our css variables should update automatically. The main remaining issue is JS code that sets colors based on the theme at the time it's run - eg the graph code, and the editor.
fec5c6d
to
2873000
Compare
This fixes basic editing - there are still components that need updating.
Thanks Rumo! I've pushed some fixes and further updates, and it seems to be in a workable state now. We'll want to update the rest of the nightModeKey contexts and check to see if anything has been missed, but let's first wait to see how the discussion on #1471 pans out The menu issue was because of the QMenuBar styling we were only applying in day mode. Similar issues may appear in other cases where we only set styling for night mode, such as the scrollbar styling - we may need to apply different colours in day mode to work around it. |
Hmm, how about rootTheme?
I started to rename things to pageTheme, but realised a nice property of documentTheme/rootTheme is that they sort of indicate where they are being set. If you're not so fond of rootTheme, happy for me to go with documentTheme instead? Naming things is hard 馃槄 |
My agenda with
If we think of Anki as a web app to be, we could also name it Once we are going to use themes for any iframes or shadow roots, they will need their own individual stores. For example for shadow roots, they don't have a |
Ok, I'll go with pageTheme for now so we can move forward with this - we can always change it again before the stable release if necessary. Assuming @RumovZ is interested, are you happy for him to proceed with updating the remaining nightModeKey references to use pageTheme instead, like in c216353? Once that's done, I presume this will be ok to merge - if there's something else we've overlooked, please let us know. |
@hgiesel gentle ping in case you missed this |
I didn't catch the question for me, sorry ^^; Sure, he can go ahead. It think |
I'll take care of it. Thanks, the two of you! |
Does the latest main commit fix it? Thanks for your work on this Rumo, I imagine there'll be quite a few users happy to see this land! |
Yes, thank you. 馃檪 Glad I could help! |
ankitects#1497 introduced reading hardcoded Windows Registry key, which assumes key exists. This is not true on Windows 7. Later addition of `try-except` block missed that OpenKey might fail. This fix allows launching current version of Anki on Windows 7 when installed with Pip with the modified Python 3.9 installation.
ankitects#1497 introduced reading hardcoded Windows Registry key, which assumes key exists. This is not true on Windows 7. Later addition of `try-except` block missed that OpenKey might fail. This fix allows launching current version of Anki on Windows 7 when installed with Pip with the modified Python 3.9 installation.
* Fix Windows dark mode detection: OpenKey can fail #1497 introduced reading hardcoded Windows Registry key, which assumes key exists. This is not true on Windows 7. Later addition of `try-except` block missed that OpenKey might fail. This fix allows launching current version of Anki on Windows 7 when installed with Pip with the modified Python 3.9 installation. * Update CONTRIBUTORS CI req: Add myself to the contributor list
This takes care of theme changes inside Qt so far.
I'm uncertain how to proceed with the webviews. What exactly did you mean by "older pages might work with .nightMode?.", @dae? The two options I can think of are either reloading the entire standard HTML or switching to night mode sensitive CSS and only toggling the class of the doc element.
As for the new pages, just a little reminder about the dsiscussion in #1471, @hgiesel. 馃檪