update tab outlines

This commit is contained in:
Alexander Frick 2023-10-16 08:05:54 -05:00
parent b2b027c4ba
commit ffcc6c58e4
3 changed files with 6 additions and 14 deletions

View file

View file

@ -21,10 +21,10 @@
"Enable High Contrast Mode", "Enable High Contrast Mode",
"Enables high contrast mode for all Thorium instances.", "Enables high contrast mode for all Thorium instances.",
kOsAll, SINGLE_VALUE_TYPE("force-high-contrast")}, kOsAll, SINGLE_VALUE_TYPE("force-high-contrast")},
{"tab-outlines-in-low-contrast-themes", {"force-enable-tab-outlines",
"Tab Outlines in Low Contrast Themes", "Force Enable Tab Outlines",
"Expands the range of situations in which tab outline strokes are displayed, improving accessiblity in dark and incognito mode.", "Force enables tab outline strokes, improving accessiblity in dark mode, incognito mode, and low contrast themes.",
kOsAll, SINGLE_VALUE_TYPE("tab-outlines-in-low-contrast-themes")}, kOsAll, SINGLE_VALUE_TYPE("force-enable-tab-outlines")},
{"prominent-dark-mode-active-tab-title", {"prominent-dark-mode-active-tab-title",
"Prominent Dark Mode Active Tab Titles", "Prominent Dark Mode Active Tab Titles",
"Makes the active tab title bolder in dark mode so that it is easier to identify.", "Makes the active tab title bolder in dark mode so that it is easier to identify.",

View file

@ -1197,17 +1197,9 @@ bool TabStrip::ShouldDrawStrokes() const {
// Don't want to have to run a full feature query every time this function is // Don't want to have to run a full feature query every time this function is
// called. // called.
static const bool tab_outlines_in_low_contrast = base::CommandLine::ForCurrentProcess()->HasSwitch("tab-outlines-in-low-contrast-themes"); static const bool force_enable_tab_outlines =
base::CommandLine::ForCurrentProcess()->HasSwitch("force-enable-tab-outlines");
if (tab_outlines_in_low_contrast) { if (tab_outlines_in_low_contrast) {
constexpr float kMinimumAbsoluteContrastForOutlines = 0.2f;
const float background_luminance =
color_utils::GetRelativeLuminance(background_color);
const float frame_luminance =
color_utils::GetRelativeLuminance(frame_color);
const float contrast_difference =
std::fabs(background_luminance - frame_luminance);
if (contrast_difference < kMinimumAbsoluteContrastForOutlines)
return true; return true;
} }