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

Unified Diff: chrome/browser/ui/views/harmony/harmony_typography_provider.cc

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: Use STYLE_HINT more. Fix SadTab Created 3 years, 7 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
Index: chrome/browser/ui/views/harmony/harmony_typography_provider.cc
diff --git a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
index 3f34d88e9d2a511a9d2a0ab2c5e6b166140d5c45..330d521b67fa665e0fa39a0328fa976c9fde9ca6 100644
--- a/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
+++ b/chrome/browser/ui/views/harmony/harmony_typography_provider.cc
@@ -6,7 +6,9 @@
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/color_palette.h"
#include "ui/gfx/platform_font.h"
+#include "ui/native_theme/native_theme.h"
#if defined(USE_ASH)
#include "ash/public/cpp/ash_typography.h" // nogncheck
@@ -56,10 +58,45 @@ const gfx::FontList& HarmonyTypographyProvider::GetFont(int text_context,
size_delta, gfx::Font::NORMAL, font_weight);
}
-SkColor HarmonyTypographyProvider::GetColor(int text_context,
- int text_style) const {
- // TODO(tapted): Look up colors from the spec.
- return SK_ColorBLACK;
+SkColor HarmonyTypographyProvider::GetColor(
+ int text_context,
+ int text_style,
+ const ui::NativeTheme& theme) const {
+ const SkColor foreground_color =
+ theme.GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
+
+ // If the default foreground color from the native theme isn't black, the rest
+ // of the Harmony spec isn't going to work. Just use the foreground color for
+ // text, with some exceptions.
+ if (foreground_color != SK_ColorBLACK) {
+ switch (text_style) {
Peter Kasting 2017/06/01 04:55:58 Seems like it might be OK to return the "red" and
tapted 2017/06/01 11:22:18 Done - Although I special-cased a white foreground
+ case views::style::STYLE_DISABLED:
+ case STYLE_SECONDARY:
+ case STYLE_HINT:
+ return theme.GetSystemColor(
+ ui::NativeTheme::kColorId_LabelDisabledColor);
+ case views::style::STYLE_LINK:
+ return theme.GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled);
+ }
+ return foreground_color;
+ }
+
+ switch (text_style) {
Peter Kasting 2017/06/01 04:55:58 Did you consider trying to implement these colors
tapted 2017/06/01 11:22:18 I didn't consider this.. But it might be overkill.
Peter Kasting 2017/06/01 19:08:01 Long-term, I'd like all the colors in all Chrome U
+ case views::style::STYLE_DIALOG_BUTTON_DEFAULT:
+ return SK_ColorWHITE;
+ case views::style::STYLE_DISABLED:
+ return SkColorSetRGB(0x9e, 0x9e, 0x9e);
+ case views::style::STYLE_LINK:
+ return gfx::kGoogleBlue700;
+ case STYLE_SECONDARY:
+ case STYLE_HINT:
+ return SkColorSetRGB(0x75, 0x75, 0x75);
+ case STYLE_RED:
+ return gfx::kGoogleRed700;
+ case STYLE_GREEN:
+ return gfx::kGoogleGreen700;
+ }
+ return SkColorSetRGB(0x21, 0x21, 0x21); // Primary for everything else.
}
int HarmonyTypographyProvider::GetLineHeight(int text_context,

Powered by Google App Engine
This is Rietveld 408576698