Commit 42a63522 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac: dark backgrounds in dark mode for secondary UI/menus.

Bug: 850098
Change-Id: If6de5922311ba501c5a746d9228993b42eff0b60
Reviewed-on: https://chromium-review.googlesource.com/c/1291569
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601709}
parent e1a6e3d4
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
namespace { namespace {
const SkColor kMenuPopupBackgroundColor = SK_ColorWHITE; const SkColor kMenuPopupBackgroundColor = SK_ColorWHITE;
// TODO(crbug.com/893598): Finalize dark mode color.
const SkColor kMenuPopupBackgroundColorDarkMode =
SkColorSetRGB(0x2B, 0x2B, 0x2B);
// Helper to make indexing an array by an enum class easier. // Helper to make indexing an array by an enum class easier.
template <class KEY, class VALUE> template <class KEY, class VALUE>
...@@ -123,7 +126,10 @@ SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const { ...@@ -123,7 +126,10 @@ SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const {
case kColorId_FocusedMenuItemBackgroundColor: case kColorId_FocusedMenuItemBackgroundColor:
return UsesHighContrastColors() ? SK_ColorDKGRAY : gfx::kGoogleGrey200; return UsesHighContrastColors() ? SK_ColorDKGRAY : gfx::kGoogleGrey200;
case kColorId_MenuBackgroundColor: case kColorId_MenuBackgroundColor:
return kMenuPopupBackgroundColor; case kColorId_BubbleBackground:
case kColorId_DialogBackground:
return SystemDarkModeEnabled() ? kMenuPopupBackgroundColorDarkMode
: kMenuPopupBackgroundColor;
case kColorId_MenuSeparatorColor: case kColorId_MenuSeparatorColor:
return UsesHighContrastColors() ? SK_ColorBLACK return UsesHighContrastColors() ? SK_ColorBLACK
: SkColorSetA(SK_ColorBLACK, 0x26); : SkColorSetA(SK_ColorBLACK, 0x26);
...@@ -160,7 +166,7 @@ void NativeThemeMac::PaintMenuPopupBackground( ...@@ -160,7 +166,7 @@ void NativeThemeMac::PaintMenuPopupBackground(
const MenuBackgroundExtraParams& menu_background) const { const MenuBackgroundExtraParams& menu_background) const {
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setColor(kMenuPopupBackgroundColor); flags.setColor(GetSystemColor(kColorId_MenuBackgroundColor));
const SkScalar radius = SkIntToScalar(menu_background.corner_radius); const SkScalar radius = SkIntToScalar(menu_background.corner_radius);
SkRect rect = gfx::RectToSkRect(gfx::Rect(size)); SkRect rect = gfx::RectToSkRect(gfx::Rect(size));
canvas->drawRoundRect(rect, radius, radius, flags); canvas->drawRoundRect(rect, radius, radius, flags);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/rect_f.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
...@@ -61,7 +62,11 @@ FootnoteContainerView::FootnoteContainerView(const gfx::Insets& margins, ...@@ -61,7 +62,11 @@ FootnoteContainerView::FootnoteContainerView(const gfx::Insets& margins,
FootnoteContainerView::~FootnoteContainerView() = default; FootnoteContainerView::~FootnoteContainerView() = default;
void FootnoteContainerView::SetCornerRadius(float corner_radius) { void FootnoteContainerView::SetCornerRadius(float corner_radius) {
SetBackground(std::make_unique<HalfRoundedRectBackground>(gfx::kGoogleGrey050, // TODO(crbug.com/893598): Finalize dark mode color.
SkColor background_color = GetNativeTheme()->SystemDarkModeEnabled()
? gfx::kGoogleGrey800
: gfx::kGoogleGrey050;
SetBackground(std::make_unique<HalfRoundedRectBackground>(background_color,
corner_radius)); corner_radius));
} }
......
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