-
Notifications
You must be signed in to change notification settings - Fork 896
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
OS(MacOS/Windows) theme controls brave theme #1805
Conversation
cb13d3f
to
2ae8d60
Compare
@petemill I think implementation is ready to review on MacOS/Windows. (lint commit is not yet pushed) |
6db26e0
to
b23f40f
Compare
b23f40f
to
a1d9a61
Compare
@simonhong this is awesome. Couple of points of feedback from usage so far on macOS 10.14 (supports dark mode):
Screenshots of examples1.a1.b2. |
@petemill |
a1d9a61
to
b497bf0
Compare
Issue 2 is fixed. but 1 is still in the dark. To avoid inconsistency between brave theme and ui element(ex, menu) on MacOS, I tried to set appearance manually to NSApplication. Then, this works fine with Found the solution how to reset manually set theme. (set |
@petemill Implementation is finished! :) Will request review when tests are ready! |
89849ad
to
cc62fc0
Compare
All issues about dark theme on MacOS are resolved. Issue 2 is also resolved on Win10. But Issue 1 would not be fixed easily in browser-side because Win10 doesn't support per-application theme. |
GetActiveBraveThemeType(profile()) == BraveThemeType::BRAVE_THEME_TYPE_LIGHT | ||
? ui::NativeThemeDarkAura::instance()->NotifyObservers() | ||
: ui::NativeTheme::GetInstanceForNativeUi()->NotifyObservers(); | ||
|
||
NotifyThemeChanged(); |
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.
This is unnecessary call. above notifying does all things.
@petemill Ready to review again. PTAL! |
kindly ping.. |
With this refactoring, webui and extension apis get more simpler and we can add system theme support more easily. And each menu item's localization is supported. Also, GetUserPreferredBraveThemeType() and GetActiveBraveThemeType() methods are unified with GetActiveBraveThemeType().
Apply OS theme to brave theme when default theme is used or user selected "Same as MacOS" menu in settings. Other options(Dark/Light) works independently with system theme. Brave on linux is not yet supported.
Change brave theme properly when user changes os theme during the runtime. NativeThemeMac notifies to proper theme observers.
If user selects light or dark, brave theme and base UI elements such as dialog or menu should use same theme. To achieve this, we override os theme with brave theme type.
On Windows, brave theme is changed properly when user changes app mode by settings when user chooses "Same as Windows" option.
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.
This is great @simonhong! Review passed on macOS. Just waiting for successful Windows 10 and 7 builds in order to test there.
In addition to the tests I specified above, I tested upgrade from 0.63.4 with two scenarios:
- User had not previously changed from default theme. This PR successfully changed the default to 'Same as macOS'.
- User had previously changed theme explicitly to Light or Dark. This PR successfully maintained that preference.
I noticed that brave/brave-browser#3708 is fixed, perhaps also by this PR.
71125ba
to
4bebc72
Compare
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.
This is awesome. Windows needs a lot of work since:
- The menus have dark text on dark background
- The LocationBar theme does not change when changing OS theme
But since we're not enabled on Windows (disabled via ui_base_features
in Brave and upstream) and some of the issues there will be solved by upstream, we're good to go since:
- The 'same as OS' feature works great on macOS 10.14
- The old Light / Dark / Default-per-channel functionality still works on non-macOS and macOS < 10.14
@petemill Yes, Windows theme needs more work so chrome team could not enable dark mode soon. |
OS(MacOS/Windows) theme controls brave theme
OS(MacOS/Windows) theme controls brave theme
Just a query, these fixes will be in a coming Brave release, it is not the current stable version (Version 0.61.51 Chromium: 73.0.3683.75) now, correct? At the moment I have a mix, Light browser chrome but Dark menus (when I select Light theme). That disconnect is jarring and unpleasant. I would prefer, when Light is selected, is for all elements (at the browser level) to be light (e.g Bookmarks bar, Setting menu etc). If a pure Light fix is coming, that is reassuring. Best regards. |
@bluz71 This PR fixed all your concerns :) |
Thank you for the confirmation, I assumed as much, but just wanted to make sure that the current release I am now using is non-optimal (confirmed as such). Looking forward to the upcoming release. Much appreciation to all the Brave team. |
Uplift #1805 to 0.63 - OS appearance mode controls Brave appearance mode (light / dark theme)
OS(MacOS/Windows) theme controls brave theme
Uplift #1805 to 0.62 - OS appearance mode controls Brave appearance mode (light / dark theme)
@simonhong @petemill does this (on macOS) require Mojave? |
@bsclifton yes |
Please see each commit's log.
Fix brave/brave-browser#1189
Fix brave/brave-browser#1289
Fix brave/brave-browser#3708
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) onnpm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
yarn test brave_browser_tests --filter=BraveThemeService*
yarn test brave_unit_tests --filter=BraveThemeServiceTest*
Manual test step
Same as MacOS
,Dark
,Light
)Same as MacOS
applies MacOS theme to brave themeReviewer Checklist: