Bug 1737322 - Use a semi-transparent dark color for middle of the focus outline in dark mode. r=mstange

Make both the light and dark colors less opaque too, since even in light
mode it looks very off IMO for stuff like:

  data:text/html,<body bgcolor=grey><input>

Differential Revision: https://phabricator.services.mozilla.com/D129302
This commit is contained in:
Emilio Cobos Álvarez 2021-10-25 16:44:04 +00:00
Родитель bda475c112
Коммит 6b058cc559
2 изменённых файлов: 8 добавлений и 12 удалений

Просмотреть файл

@ -424,7 +424,7 @@ sRGBColor nsNativeBasicTheme::ComputeCheckmarkColor(const EventStates& aState,
return aColors.System(StyleSystemColor::Selecteditemtext);
}
if (aState.HasState(NS_EVENT_STATE_DISABLED)) {
return sColorWhiteAlpha80;
return sRGBColor::White(.8f);
}
return aColors.Accent().GetForeground();
}
@ -579,8 +579,7 @@ std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeRangeThumbColors(
return sColorGrey50;
}();
const sRGBColor borderColor = sColorWhite;
const sRGBColor borderColor = sRGBColor::OpaqueWhite();
return std::make_pair(backgroundColor, borderColor);
}
@ -628,9 +627,10 @@ std::array<sRGBColor, 3> nsNativeBasicTheme::ComputeFocusRectColors(
aColors.System(StyleSystemColor::Buttontext),
aColors.System(StyleSystemColor::TextBackground)};
}
return {aColors.Accent().Get(), sColorWhiteAlpha80,
aColors.Accent().GetLight()};
const auto& accent = aColors.Accent();
const sRGBColor middle =
aColors.IsDark() ? sRGBColor::Black(.3f) : sRGBColor::White(.3f);
return {accent.Get(), middle, accent.GetLight()};
}
bool nsNativeBasicTheme::IsScrollbarTrackOpaque(nsIFrame* aFrame) {

Просмотреть файл

@ -20,14 +20,10 @@ enum class StyleSystemColor : uint8_t;
namespace widget {
static constexpr gfx::sRGBColor sColorWhite(gfx::sRGBColor::OpaqueWhite());
static constexpr gfx::sRGBColor sColorWhiteAlpha50(gfx::sRGBColor::White(0.5f));
static constexpr gfx::sRGBColor sColorWhiteAlpha80(gfx::sRGBColor::White(0.8f));
static constexpr gfx::sRGBColor sColorBlack(gfx::sRGBColor::OpaqueBlack());
static constexpr gfx::sRGBColor sDefaultAccent(
gfx::sRGBColor::UnusualFromARGB(0xff0060df)); // Luminance: 13.69346%
static constexpr gfx::sRGBColor sDefaultAccentForeground(sColorWhite);
static constexpr gfx::sRGBColor sDefaultAccentForeground(
gfx::sRGBColor::OpaqueWhite());
static constexpr gfx::sRGBColor sColorGrey10(
gfx::sRGBColor::UnusualFromARGB(0xffe9e9ed));