Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uplift "Fix Unreadable Text Colors" #3801 to 0.72.x #3815

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
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_