forked from brave/brave-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request brave#13841 from brave/new_tab_button_bg_color
Migrated colors that used in theme_properties to color provider pipeline
- Loading branch information
Showing
19 changed files
with
348 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright (c) 2022 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/. */ | ||
|
||
#include "brave/browser/themes/brave_private_window_theme_supplier.h" | ||
|
||
#include "brave/browser/ui/color/brave_color_mixer.h" | ||
#include "ui/color/color_provider_manager.h" | ||
|
||
BravePrivateWindowThemeSupplier::BravePrivateWindowThemeSupplier( | ||
bool private_window) | ||
: CustomThemeSupplier(ThemeType::kAutogenerated), | ||
for_private_window_(private_window) {} | ||
|
||
BravePrivateWindowThemeSupplier::~BravePrivateWindowThemeSupplier() = default; | ||
|
||
void BravePrivateWindowThemeSupplier::AddColorMixers( | ||
ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) const { | ||
for_private_window_ ? AddBravePrivateThemeColorMixer(provider, key) | ||
: AddBraveTorThemeColorMixer(provider, key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Copyright (c) 2022 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_BROWSER_THEMES_BRAVE_PRIVATE_WINDOW_THEME_SUPPLIER_H_ | ||
#define BRAVE_BROWSER_THEMES_BRAVE_PRIVATE_WINDOW_THEME_SUPPLIER_H_ | ||
|
||
#include "chrome/browser/themes/custom_theme_supplier.h" | ||
|
||
// A theme supplier for private (or tor) window. | ||
class BravePrivateWindowThemeSupplier : public CustomThemeSupplier { | ||
public: | ||
explicit BravePrivateWindowThemeSupplier(bool private_window); | ||
|
||
BravePrivateWindowThemeSupplier(const BravePrivateWindowThemeSupplier&) = | ||
delete; | ||
BravePrivateWindowThemeSupplier& operator=( | ||
const BravePrivateWindowThemeSupplier&) = delete; | ||
|
||
protected: | ||
~BravePrivateWindowThemeSupplier() override; | ||
|
||
void AddColorMixers(ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) const override; | ||
|
||
// false if this is for tor window. | ||
bool for_private_window_ = true; | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_THEMES_BRAVE_PRIVATE_WINDOW_THEME_SUPPLIER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* Copyright (c) 2022 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/. */ | ||
|
||
#include "brave/browser/ui/color/brave_color_mixer.h" | ||
|
||
#include "brave/browser/ui/color/color_palette.h" | ||
#include "chrome/browser/ui/color/chrome_color_id.h" | ||
#include "ui/color/color_id.h" | ||
#include "ui/color/color_provider.h" | ||
#include "ui/color/color_recipe.h" | ||
#include "ui/gfx/color_palette.h" | ||
#include "ui/gfx/color_utils.h" | ||
|
||
void AddBraveLightThemeColorMixer(ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) { | ||
ui::ColorMixer& mixer = provider->AddMixer(); | ||
|
||
mixer[kColorDownloadShelfButtonText] = {gfx::kBraveGrey800}; | ||
|
||
mixer[ui::kColorFrameActive] = {kLightFrame}; | ||
mixer[kColorTabBackgroundInactiveFrameActive] = {ui::kColorFrameActive}; | ||
mixer[kColorNewTabButtonBackgroundFrameActive] = {ui::kColorFrameActive}; | ||
mixer[kColorToolbarContentAreaSeparator] = {ui::kColorFrameActive}; | ||
|
||
mixer[ui::kColorFrameInactive] = { | ||
color_utils::HSLShift(kLightFrame, {-1, -1, 0.6})}; | ||
mixer[kColorTabBackgroundInactiveFrameInactive] = {ui::kColorFrameInactive}; | ||
mixer[kColorNewTabButtonBackgroundFrameInactive] = {ui::kColorFrameInactive}; | ||
|
||
mixer[kColorToolbar] = {kLightToolbar}; | ||
mixer[kColorToolbarTopSeparatorFrameActive] = {kColorToolbar}; | ||
mixer[kColorToolbarTopSeparatorFrameInactive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameActive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameInactive] = {kColorToolbar}; | ||
|
||
mixer[kColorTabForegroundActiveFrameActive] = {kLightToolbarIcon}; | ||
mixer[kColorTabForegroundInactiveFrameActive] = { | ||
kColorTabForegroundActiveFrameActive}; | ||
mixer[kColorBookmarkBarForeground] = {kColorTabForegroundActiveFrameActive}; | ||
mixer[kColorToolbarButtonIcon] = {kColorTabForegroundActiveFrameActive}; | ||
|
||
mixer[kColorToolbarButtonIconInactive] = { | ||
color_utils::AlphaBlend(kLightToolbarIcon, kLightToolbar, 0.3f)}; | ||
} | ||
|
||
void AddBraveDarkThemeColorMixer(ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) { | ||
ui::ColorMixer& mixer = provider->AddMixer(); | ||
|
||
mixer[kColorDownloadShelfButtonText] = {SK_ColorWHITE}; | ||
|
||
mixer[ui::kColorFrameActive] = {kDarkFrame}; | ||
mixer[kColorTabBackgroundInactiveFrameActive] = {ui::kColorFrameActive}; | ||
mixer[kColorNewTabButtonBackgroundFrameActive] = {ui::kColorFrameActive}; | ||
|
||
mixer[ui::kColorFrameInactive] = { | ||
color_utils::HSLShift(kDarkFrame, {-1, -1, 0.6})}; | ||
mixer[kColorTabBackgroundInactiveFrameInactive] = {ui::kColorFrameInactive}; | ||
mixer[kColorNewTabButtonBackgroundFrameInactive] = {ui::kColorFrameInactive}; | ||
|
||
mixer[kColorToolbar] = {kDarkToolbar}; | ||
mixer[kColorToolbarTopSeparatorFrameActive] = {kColorToolbar}; | ||
mixer[kColorToolbarTopSeparatorFrameInactive] = {kColorToolbar}; | ||
mixer[kColorToolbarContentAreaSeparator] = {kColorToolbar}; | ||
mixer[kColorTabStrokeFrameActive] = {kColorToolbar}; | ||
mixer[kColorTabStrokeFrameInactive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameActive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameInactive] = {kColorToolbar}; | ||
|
||
mixer[kColorTabForegroundActiveFrameActive] = { | ||
SkColorSetRGB(0xF3, 0xF3, 0xF3)}; | ||
mixer[kColorBookmarkBarForeground] = {kColorTabForegroundActiveFrameActive}; | ||
mixer[kColorTabForegroundInactiveFrameActive] = { | ||
kColorTabForegroundActiveFrameActive}; | ||
mixer[kColorToolbarButtonIcon] = {kDarkToolbarIcon}; | ||
|
||
mixer[kColorToolbarButtonIconInactive] = { | ||
color_utils::AlphaBlend(kDarkToolbarIcon, kDarkToolbar, 0.3f)}; | ||
} | ||
|
||
void AddBravePrivateThemeColorMixer(ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) { | ||
AddBraveDarkThemeColorMixer(provider, key); | ||
|
||
ui::ColorMixer& mixer = provider->AddMixer(); | ||
|
||
mixer[ui::kColorFrameActive] = {kPrivateFrame}; | ||
mixer[kColorTabBackgroundInactiveFrameActive] = {ui::kColorFrameActive}; | ||
mixer[kColorNewTabButtonBackgroundFrameActive] = {ui::kColorFrameActive}; | ||
|
||
mixer[ui::kColorFrameInactive] = { | ||
color_utils::HSLShift(kPrivateFrame, {-1, -1, 0.55})}; | ||
mixer[kColorTabBackgroundInactiveFrameInactive] = {ui::kColorFrameInactive}; | ||
mixer[kColorNewTabButtonBackgroundFrameInactive] = {ui::kColorFrameInactive}; | ||
|
||
mixer[kColorToolbar] = {kPrivateToolbar}; | ||
mixer[kColorToolbarContentAreaSeparator] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameActive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameInactive] = {kColorToolbar}; | ||
|
||
mixer[kColorTabForegroundActiveFrameActive] = { | ||
SkColorSetRGB(0xF3, 0xF3, 0xF3)}; | ||
|
||
mixer[kColorBookmarkBarForeground] = {SkColorSetRGB(0xFF, 0xFF, 0xFF)}; | ||
mixer[kColorTabForegroundInactiveFrameActive] = { | ||
SkColorSetRGB(0xFF, 0xFF, 0xFF)}; | ||
|
||
mixer[kColorToolbarButtonIcon] = {kDarkToolbarIcon}; | ||
mixer[kColorToolbarButtonIconInactive] = { | ||
color_utils::AlphaBlend(kDarkToolbarIcon, kPrivateToolbar, 0.3f)}; | ||
} | ||
|
||
void AddBraveTorThemeColorMixer(ui::ColorProvider* provider, | ||
const ui::ColorProviderManager::Key& key) { | ||
AddBravePrivateThemeColorMixer(provider, key); | ||
|
||
ui::ColorMixer& mixer = provider->AddMixer(); | ||
|
||
mixer[ui::kColorFrameActive] = {kPrivateTorFrame}; | ||
mixer[kColorTabBackgroundInactiveFrameActive] = {ui::kColorFrameActive}; | ||
mixer[kColorNewTabButtonBackgroundFrameActive] = {ui::kColorFrameActive}; | ||
|
||
mixer[ui::kColorFrameInactive] = { | ||
color_utils::HSLShift(kPrivateTorFrame, {-1, -1, 0.55})}; | ||
mixer[kColorTabBackgroundInactiveFrameInactive] = {ui::kColorFrameInactive}; | ||
mixer[kColorNewTabButtonBackgroundFrameInactive] = {ui::kColorFrameInactive}; | ||
|
||
mixer[kColorToolbar] = {kPrivateTorToolbar}; | ||
mixer[kColorToolbarContentAreaSeparator] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameActive] = {kColorToolbar}; | ||
mixer[kColorTabBackgroundActiveFrameInactive] = {kColorToolbar}; | ||
|
||
mixer[kColorToolbarButtonIconInactive] = { | ||
color_utils::AlphaBlend(kDarkToolbarIcon, kPrivateTorToolbar, 0.3f)}; | ||
} |
Oops, something went wrong.