Commit c45d868e authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Change alpha for stroke to 0x5f.

Bug: 737271
Change-Id: Ic87eed4db221b93d4aca8d7bead66a4208b4b53f
Reviewed-on: https://chromium-review.googlesource.com/571174
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488722}
parent 21937dad
...@@ -250,6 +250,10 @@ void MdTextButton::UpdateColors() { ...@@ -250,6 +250,10 @@ void MdTextButton::UpdateColors() {
if (!explicitly_set_normal_color()) { if (!explicitly_set_normal_color()) {
const auto colors = explicitly_set_colors(); const auto colors = explicitly_set_colors();
LabelButton::SetEnabledTextColors(enabled_text_color); LabelButton::SetEnabledTextColors(enabled_text_color);
if (state() == STATE_DISABLED && !is_prominent_)
LabelButton::SetTextColor(STATE_DISABLED,
style::GetColor(label()->text_context(),
style::STYLE_DISABLED, theme));
set_explicitly_set_colors(colors); set_explicitly_set_colors(colors);
} }
...@@ -278,20 +282,24 @@ void MdTextButton::UpdateColors() { ...@@ -278,20 +282,24 @@ void MdTextButton::UpdateColors() {
bg_color = color_utils::GetResultingPaintColor(shade, bg_color); bg_color = color_utils::GetResultingPaintColor(shade, bg_color);
} }
// Specified text color: 5a5a5a @ 1.0 alpha // Specified text color: 5a5a5a @ 1.0 alpha, 757575 @ 1.0 alpha for Harmony
// Specified stroke color: 000000 @ 0.2 alpha // Specified stroke color: 000000 @ 0.2 alpha, Harmony and non-Harmony
// 000000 @ 0.2 is very close to 5a5a5a @ 0.308 (== 0x4e); both are cccccc @ // 000000 @ 0.2 is very close to 5a5a5a @ 0.308 (== 0x4e) or 757575 @ 0.37
// 1.0, and this way if NativeTheme changes the button color, the button // (== 0x5f); both are cccccc @ 1.0, and this way if NativeTheme changes the
// stroke will also change colors to match. // button color, the button stroke will also change colors to match.
SkColor stroke_color = SkColor stroke_color =
is_prominent_ ? SK_ColorTRANSPARENT : SkColorSetA(text_color, 0x4e); is_prominent_ ? SK_ColorTRANSPARENT
: SkColorSetA(text_color,
// Disabled, non-prominent buttons need their stroke lightened. Prominent UseMaterialSecondaryButtons() ? 0x5f : 0x4e);
// Disabled, non-prominent buttons need their stroke lightened. The Harmony
// spec asks for 000000 @ 0.1 alpha or e6e6e6 @ 1.0 alpha. The stroke color
// has already been translated above to cccccc @ 1.0 or 000000 @ 0.2.
// cccccc @ 0.25 (== 0x41) translates to e6e6e6 @ 1.0. To simplify the code,
// 000000 @ 0.1 is being used for both Harmony and non-Harmony. Prominent
// buttons need it left at SK_ColorTRANSPARENT from above. // buttons need it left at SK_ColorTRANSPARENT from above.
if (state() == STATE_DISABLED && !is_prominent_) { if (state() == STATE_DISABLED && !is_prominent_)
stroke_color = color_utils::BlendTowardOppositeLuma( stroke_color = SkColorSetA(stroke_color, 0x41);
stroke_color, gfx::kDisabledControlAlpha);
}
DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
SetBackground( SetBackground(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment