Skip to content

Commit

Permalink
Merge pull request #3815 from brave/fix-text-color-72x
Browse files Browse the repository at this point in the history
Uplift "Fix Unreadable Text Colors" #3801 to 0.72.x
  • Loading branch information
bsclifton authored Oct 31, 2019
2 parents b165c41 + 1c6205e commit 5ea5ee2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 13 deletions.
47 changes: 34 additions & 13 deletions chromium_src/chrome/browser/ui/views/chrome_typography_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
19 changes: 19 additions & 0 deletions chromium_src/chrome/browser/ui/views/chrome_typography_provider.h
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit 5ea5ee2

Please sign in to comment.