chromium dark chromium dark chromium dark chromium dark chromium dark chromium dark chromium da
This commit is contained in:
parent
620b4680d7
commit
9f07d7f27c
34
home-manager/data/chromium-dark.patch
Normal file
34
home-manager/data/chromium-dark.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc
|
||||
index 4afa399..fbaaf06e 100644
|
||||
--- a/ui/gtk/native_theme_gtk.cc
|
||||
+++ b/ui/gtk/native_theme_gtk.cc
|
||||
@@ -116,6 +116,13 @@
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(AddGtkNativeCoreColorMixer));
|
||||
|
||||
+ // Add the web native theme as an observer to stay in sync with dark mode,
|
||||
+ // high contrast, and preferred color scheme changes.
|
||||
+ color_scheme_observer_ =
|
||||
+ std::make_unique<NativeTheme::ColorSchemeNativeThemeObserver>(
|
||||
+ NativeTheme::GetInstanceForWeb());
|
||||
+ AddObserver(color_scheme_observer_.get());
|
||||
+
|
||||
OnThemeChanged(gtk_settings_get_default(), nullptr);
|
||||
}
|
||||
|
||||
diff --git a/ui/gtk/native_theme_gtk.h b/ui/gtk/native_theme_gtk.h
|
||||
index 876a738..ad3b88d41 100644
|
||||
--- a/ui/gtk/native_theme_gtk.h
|
||||
+++ b/ui/gtk/native_theme_gtk.h
|
||||
@@ -93,6 +93,11 @@
|
||||
mutable absl::optional<SkColor> color_cache_[kColorId_NumColors];
|
||||
|
||||
ScopedCssProvider theme_css_override_;
|
||||
+
|
||||
+ // Used to notify the web native theme of changes to dark mode, high
|
||||
+ // contrast, and preferred color scheme.
|
||||
+ std::unique_ptr<NativeTheme::ColorSchemeNativeThemeObserver>
|
||||
+ color_scheme_observer_;
|
||||
};
|
||||
|
||||
} // namespace gtk
|
@ -573,8 +573,10 @@ in
|
||||
|
||||
programs.chromium = {
|
||||
enable = lib.mkDefault true;
|
||||
package = lib.mkDefault (pkgs.ungoogled-chromium.override {
|
||||
commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";
|
||||
package = lib.mkDefault ((pkgs.ungoogled-chromium.overrideAttrs (old: {
|
||||
patches = [ ../data/chromium-dark.patch ];
|
||||
})).override {
|
||||
commandLineArgs = "--enable-features=UseOzonePlatform,WebUIDarkMode --ozone-platform=wayland --force-dark-mode";
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user