diff --git a/chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc b/chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc index 45de20b5583e..97dbba9d11ad 100644 --- a/chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc +++ b/chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc @@ -3,21 +3,42 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // you can obtain one at http://mozilla.org/MPL/2.0/. -#include "chrome/browser/ui/views/chrome_typography_provider.h" #include "ui/gfx/color_palette.h" +#include "ui/views/style/typography.h" + +// Comes after the above includes. +#include "chrome/browser/ui/views/chrome_typography_provider.h" -namespace gfx { - const SkColor kBraveWhite = SkColorSetRGB(0xff, 0xff, 0xff); +namespace { const SkColor kBraveGrey800 = SkColorSetRGB(0x3b, 0x3e, 0x4f); } -// Button text color -#define kGoogleGrey900 kBraveWhite -// Button text color (prominent, dark mode) -#define kGoogleBlue300 kBraveWhite -// // Button text color (prominent, light mode) -#define kGoogleBlue600 kBraveGrey800 -#include "../../../../../chrome/browser/ui/views/chrome_typography_provider.cc" -#undef kGoogleGrey900 -#undef kGoogleBlue300 -#undef kGoogleBlue600 +#define GetColor GetColor_ChromiumImpl +#include "../../../../../../chrome/browser/ui/views/chrome_typography_provider.cc" +#undef GetColor + +SkColor ChromeTypographyProvider::GetColor(const views::View& view, + int context, + int style) const { + // Harmony check duplicated from ChromiumImpl + const ui::NativeTheme* native_theme = view.GetNativeTheme(); + DCHECK(native_theme); + if (ShouldIgnoreHarmonySpec(*native_theme)) { + return GetHarmonyTextColorForNonStandardNativeTheme(context, style, + *native_theme); + } + // Override button text colors + if (context == views::style::CONTEXT_BUTTON_MD) { + switch (style) { + case views::style::STYLE_DIALOG_BUTTON_DEFAULT: + return SK_ColorWHITE; + case views::style::STYLE_DISABLED: + // Keep chromium style for this state. + break; + default: + return native_theme->ShouldUseDarkColors() ? SK_ColorWHITE + : kBraveGrey800; + } + } + return GetColor_ChromiumImpl(view, context, style); +} diff --git a/chromium_src/chrome/browser/ui/views/chrome_typography_provider.h b/chromium_src/chrome/browser/ui/views/chrome_typography_provider.h new file mode 100644 index 000000000000..9b98a8252a0f --- /dev/null +++ b/chromium_src/chrome/browser/ui/views/chrome_typography_provider.h @@ -0,0 +1,19 @@ +// Copyright (c) 2019 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_CHROME_TYPOGRAPHY_PROVIDER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_CHROME_TYPOGRAPHY_PROVIDER_H_ + +#include "ui/views/style/typography_provider.h" + +#define GetColor \ + GetColor_ChromiumImpl(const views::View& view, \ + int context, \ + int style) const; \ + SkColor GetColor +#include "../../../../../../chrome/browser/ui/views/chrome_typography_provider.h" +#undef GetColor + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_CHROME_TYPOGRAPHY_PROVIDER_H_