Commit d0b3f4df authored by Ionel Popescu's avatar Ionel Popescu Committed by Commit Bot

Use custom alpha value for the focus ring color.

Currently when an user changes the system accent color on Mac, that
color is going to be used as the focus ring.

This CL changes the used focus ring color by taking just the RGB values
from the accent color. A custom alpha value of 128 is used in order to
avoid having a color too light which affects accessibility.

Bug: 1051391
Change-Id: I8416739ca42ef8deeeca5faf932d6dd9e0fed26a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057865Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#742364}
parent 960b3219
......@@ -322,8 +322,15 @@ Color LayoutThemeMacRefresh::FocusRingColor() const {
if (UsesTestModeFocusRingColor())
return kDefaultFocusRingColor;
Color keyboard_focus_indicator =
GetSystemColor(MacSystemColorID::kKeyboardFocusIndicator);
// Take the RGB values from the keyboard_focus_indicator color, but use a
// different alpha value to avoid having a color too light.
Color focus_ring =
Color(keyboard_focus_indicator.Red(), keyboard_focus_indicator.Green(),
keyboard_focus_indicator.Blue(), /*alpha=*/128);
if (!HasCustomFocusRingColor())
return GetSystemColor(MacSystemColorID::kKeyboardFocusIndicator);
return focus_ring;
// Use the custom focus ring color when the system accent color wasn't
// changed.
......@@ -341,7 +348,7 @@ Color LayoutThemeMacRefresh::FocusRingColor() const {
}
}
return GetSystemColor(MacSystemColorID::kKeyboardFocusIndicator);
return focus_ring;
}
bool LayoutThemeMacRefresh::UsesTestModeFocusRingColor() const {
......
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