mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
fix: propagate preferred color scheme to the renderer (#22896)
* fix: do not crash if the window is closed syncronously with a nativeTheme change * fix: propogate preferred color scheme to the renderer and keep it up to date
This commit is contained in:
@@ -524,6 +524,11 @@ void ElectronBrowserClient::OverrideWebkitPrefs(
|
||||
prefs->picture_in_picture_enabled = false;
|
||||
#endif
|
||||
|
||||
ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
|
||||
prefs->preferred_color_scheme = native_theme->ShouldUseDarkColors()
|
||||
? blink::PreferredColorScheme::kDark
|
||||
: blink::PreferredColorScheme::kLight;
|
||||
|
||||
SetFontDefaults(prefs);
|
||||
|
||||
// Custom preferences of guest page.
|
||||
|
||||
Reference in New Issue
Block a user