-
Notifications
You must be signed in to change notification settings - Fork 0
/
themecolor.patch
28 lines (27 loc) · 1.1 KB
/
themecolor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 9fc191305a15c..b18c84c98fe27 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -432,6 +432,23 @@ absl::optional<SkColor> BrowserFrame::GetUserColor() const {
return absl::nullopt;
}
+ ////////////////////////////////////////////
+ ////// Using theme-color meta tag //////////
+ ////////////////////////////////////////////
+
+ content::WebContents* web_contents =
+ browser_view_->browser()->tab_strip_model()->GetActiveWebContents();
+
+ if (web_contents) {
+ absl::optional<SkColor> color = web_contents->GetThemeColor();
+ if (color){
+ if (color.has_value()) {
+ // LOG(INFO) << "theme-color: " << std::hex << color.value() << std::setw(6) << std::setfill('0');
+ return SkColorSetA(color.value(), SK_AlphaOPAQUE);
+ }
+ }
+ }
+
const auto* theme_service =
ThemeServiceFactory::GetForProfile(browser_view_->browser()->profile());
return theme_service->UsingAutogeneratedTheme()