Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5077)

Unified Diff: chrome/browser/ui/cocoa/chrome_browser_window.mm

Issue 2068243002: [Mac][Material Design] Adjust cutoff for detecting a "dark" theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/chrome_browser_window.mm
diff --git a/chrome/browser/ui/cocoa/chrome_browser_window.mm b/chrome/browser/ui/cocoa/chrome_browser_window.mm
index e9894b36ce691eeb6445bb8c4415253452c16b99..6470d5c1615b2b621a56b33d40e581df5fc035a8 100644
--- a/chrome/browser/ui/cocoa/chrome_browser_window.mm
+++ b/chrome/browser/ui/cocoa/chrome_browser_window.mm
@@ -9,6 +9,16 @@
#import "chrome/browser/ui/cocoa/themed_window.h"
#include "ui/base/theme_provider.h"
+namespace {
+
+// Upper and lower bounds for determining if a theme's colors indicate that
+// it's a "dark" theme. In Material Design, dark themes have controls that are
+// drawn using transparent white instead of a transparent shade of gray.
+const CGFloat kDarkThemeToolbarColorUpperBound = 0.55;
+const CGFloat kDarkThemeTabTextColorLowerBound = 0.7;
+
+} // namespace
+
@interface NSWindow (Private)
- (BOOL)hasKeyAppearance;
@end
@@ -65,7 +75,7 @@
[theColor colorUsingColorSpaceName:NSCalibratedWhiteColorSpace];
if (theColor != nil) {
// The white componement cutoff is an empirical value.
- return [theColor whiteComponent] < 0.7;
+ return [theColor whiteComponent] < kDarkThemeToolbarColorUpperBound;
}
}
@@ -77,7 +87,7 @@
theColor =
[theColor colorUsingColorSpaceName:NSCalibratedWhiteColorSpace];
if (theColor != nil) {
- return [theColor whiteComponent] >= 0.7;
+ return [theColor whiteComponent] >= kDarkThemeTabTextColorLowerBound;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698