Chromium Code Reviews| Index: ui/views/controls/button/md_text_button.cc |
| diff --git a/ui/views/controls/button/md_text_button.cc b/ui/views/controls/button/md_text_button.cc |
| index 44d111c80dff5219baba969b59ba615dc8a2cbe5..8f5e960fcf0ea44b91f125e84fd85be5f9288230 100644 |
| --- a/ui/views/controls/button/md_text_button.cc |
| +++ b/ui/views/controls/button/md_text_button.cc |
| @@ -287,16 +287,24 @@ void MdTextButton::UpdateColors() { |
| if (!explicitly_set_normal_color()) |
| LabelButton::SetEnabledTextColors(theme->GetSystemColor(fg_color_id)); |
| + // CTA buttons keep their enabled text color; disabled state is conveyed by |
| + // shading the background instead. |
| + if (is_cta_) |
| + SetTextColor(STATE_DISABLED, theme->GetSystemColor(fg_color_id)); |
| + |
| SkColor text_color = label()->enabled_color(); |
| - SkColor bg_color = |
| - bg_color_override_ |
| - ? *bg_color_override_ |
| - : is_cta_ |
| - ? theme->GetSystemColor( |
| - ui::NativeTheme::kColorId_CallToActionColor) |
| - : is_default() |
| - ? color_utils::BlendTowardOppositeLuma(text_color, 0xD8) |
| - : SK_ColorTRANSPARENT; |
| + SkColor bg_color = SK_ColorTRANSPARENT; |
| + |
| + if (bg_color_override_) { |
| + bg_color = *bg_color_override_; |
| + } else if (is_cta_) { |
| + bg_color = theme->GetSystemColor( |
| + ui::NativeTheme::kColorId_CallToActionColor); |
| + if (state() == STATE_DISABLED) |
| + bg_color = SkColorSetA(bg_color, 0x61); |
|
Evan Stade
2016/09/07 17:14:33
I know it's expressed as an alpha value in the spe
Elly Fong-Jones
2016/09/07 18:01:45
Done.
|
| + } else if (is_default()) { |
| + bg_color = color_utils::BlendTowardOppositeLuma(text_color, 0xD8); |
| + } |
| bg_color = PlatformStyle::BackgroundColorForMdButton(bg_color, state()); |
|
Evan Stade
2016/09/07 17:14:33
can we make it a todo to get rid of this? Color lo
Elly Fong-Jones
2016/09/07 17:43:50
Hm - I like this idea, but what would color_utils:
Elly Fong-Jones
2016/09/07 18:01:45
I ended up adding a TODO for this.
|