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

Fixed tab color regressions from https://github.com/brave/brave-core/pull/27008 #27123

Merged
merged 4 commits into from
Jan 7, 2025
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
2 changes: 2 additions & 0 deletions browser/ui/color/brave_color_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#define BRAVE_VERTICAL_TAB_COLOR_IDS \
E_CPONLY(kColorBraveVerticalTabSeparator) \
E_CPONLY(kColorBraveVerticalTabActiveBackground) \
E_CPONLY(kColorBraveVerticalTabHoveredBackground) \
E_CPONLY(kColorBraveVerticalTabInactiveBackground) \
E_CPONLY(kColorBraveVerticalTabNTBIconColor) \
E_CPONLY(kColorBraveVerticalTabNTBTextColor) \
Expand All @@ -127,6 +128,7 @@
#define BRAVE_SPLIT_VIEW_COLOR_IDS \
E_CPONLY(kColorBraveSplitViewTileBackgroundHorizontal) \
E_CPONLY(kColorBraveSplitViewTileBackgroundVertical) \
E_CPONLY(kColorBraveSplitViewTileBackgroundBorder) \
E_CPONLY(kColorBraveSplitViewTileDivider) \
E_CPONLY(kColorBraveSplitViewActiveWebViewBorder) \
E_CPONLY(kColorBraveSplitViewInactiveWebViewBorder) \
Expand Down
51 changes: 38 additions & 13 deletions browser/ui/tabs/brave_tab_color_mixer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,34 @@ void AddBraveTabThemeColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderKey& key) {
auto& mixer = provider->AddMixer();

mixer[kColorBraveVerticalTabActiveBackground] = {
kColorTabBackgroundInactiveFrameActive};
if (key.custom_theme) {
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
SkColorSetARGB(0x1A, 0x00, 0x00, 0x00)};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
kColorBraveSplitViewTileBackgroundHorizontal};
mixer[kColorBraveSplitViewTileBackgroundBorder] = {
SkColorSetARGB(0x34, 0xFF, 0xFF, 0xFF)};
mixer[kColorBraveSplitViewTileDivider] = {kColorTabDividerFrameActive};
mixer[kColorBraveVerticalTabActiveBackground] = {
kColorTabBackgroundInactiveFrameActive};
mixer[kColorBraveVerticalTabHoveredBackground] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

ui::AlphaBlend(kColorBraveVerticalTabActiveBackground,
kColorBraveVerticalTabInactiveBackground,
/* 40% opacity */ 0.4 * SK_AlphaOPAQUE)};
} else {
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorDesktopbrowserTabbarSplitViewBackgroundHorizontal};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
nala::kColorDesktopbrowserTabbarSplitViewBackgroundVertical};
mixer[kColorBraveSplitViewTileBackgroundBorder] = {SK_ColorTRANSPARENT};
mixer[kColorBraveSplitViewTileDivider] = {
nala::kColorDesktopbrowserTabbarSplitViewDivider};
mixer[kColorBraveVerticalTabActiveBackground] = {
nala::kColorDesktopbrowserTabbarActiveTabVertical};
mixer[kColorBraveVerticalTabHoveredBackground] = {
nala::kColorDesktopbrowserTabbarHoverTabVertical};
}

mixer[kColorBraveVerticalTabInactiveBackground] = {kColorToolbar};
mixer[kColorBraveVerticalTabSeparator] = {kColorToolbarContentAreaSeparator};
mixer[kColorBraveVerticalTabNTBIconColor] = {
Expand All @@ -31,13 +57,6 @@ void AddBraveTabThemeColorMixer(ui::ColorProvider* provider,
kColorTabForegroundInactiveFrameActive};
mixer[kColorBraveVerticalTabNTBShortcutTextColor] = {
kColorTabForegroundActiveFrameActive};

mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorDesktopbrowserTabbarSplitViewBackgroundHorizontal};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
nala::kColorDesktopbrowserTabbarSplitViewBackgroundVertical};
mixer[kColorBraveSplitViewTileDivider] = {
nala::kColorDesktopbrowserTabbarSplitViewDivider};
mixer[kColorBraveSplitViewMenuItemIcon] = {nala::kColorIconDefault};
mixer[kColorBraveSplitViewUrl] = {nala::kColorTextTertiary};
mixer[kColorBraveSplitViewMenuButtonBorder] = {nala::kColorDividerSubtle};
Expand All @@ -61,29 +80,35 @@ void AddBraveTabPrivateThemeColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderKey& key) {
auto& mixer = provider->AddMixer();
mixer[kColorBraveVerticalTabActiveBackground] = {
mixer.GetResultColor(kColorTabBackgroundActiveFrameActive)};
nala::kColorPrimitivePrivateWindow30};
mixer[kColorBraveVerticalTabInactiveBackground] = {
mixer.GetResultColor(kColorToolbar)};
mixer[kColorBraveVerticalTabHoveredBackground] = {
nala::kColorPrimitivePrivateWindow15};
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorPrimitivePrivateWindow10};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
kColorBraveSplitViewTileBackgroundHorizontal};
nala::kColorPrimitivePrivateWindow5};
mixer[kColorBraveSplitViewTileDivider] = {
nala::kColorPrimitivePrivateWindow20};
mixer[kColorBraveSplitViewTileBackgroundBorder] = {SK_ColorTRANSPARENT};
}

void AddBraveTabTorThemeColorMixer(ui::ColorProvider* provider,
const ui::ColorProviderKey& key) {
auto& mixer = provider->AddMixer();
mixer[kColorBraveVerticalTabActiveBackground] = {
mixer.GetResultColor(kColorTabBackgroundActiveFrameActive)};
nala::kColorPrimitiveTorWindow30};
mixer[kColorBraveVerticalTabInactiveBackground] = {
mixer.GetResultColor(kColorToolbar)};
mixer[kColorBraveVerticalTabHoveredBackground] = {
nala::kColorPrimitiveTorWindow15};
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorPrimitiveTorWindow10};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
kColorBraveSplitViewTileBackgroundHorizontal};
nala::kColorPrimitiveTorWindow5};
mixer[kColorBraveSplitViewTileDivider] = {nala::kColorPrimitiveTorWindow20};
mixer[kColorBraveSplitViewTileBackgroundBorder] = {SK_ColorTRANSPARENT};
}

} // namespace tabs
10 changes: 7 additions & 3 deletions browser/ui/views/tabs/brave_tab_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,14 @@ void BraveTabContainer::PaintBoundingBoxForTile(gfx::Canvas& canvas,
separator_top.Offset(0, gap);
auto separator_bottom = separator_top;
separator_bottom.Offset(0, kSplitViewSeparatorHeight);
canvas.DrawLine(
separator_top, separator_bottom,
cp->GetColor(nala::kColorDesktopbrowserTabbarSplitViewDivider));
canvas.DrawLine(separator_top, separator_bottom,
cp->GetColor(kColorBraveSplitViewTileDivider));
}

bounding_rects.Outset(1);
flags.setStyle(cc::PaintFlags::kStroke_Style);
flags.setColor(cp->GetColor(kColorBraveSplitViewTileBackgroundBorder));
canvas.DrawRoundRect(bounding_rects, kRadius, flags);
}

void BraveTabContainer::OnUnlockLayout() {
Expand Down
8 changes: 3 additions & 5 deletions browser/ui/views/tabs/brave_tab_style_views.inc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,7 @@ SkColor BraveVerticalTabStyle::GetTargetTabBackgroundColor(
// dragging here. As having selected tab state in a tile is not a
// common state, I think it's fine to not have that state in a tile.
if (IsTabTiled(tab()) && !tab()->IsActive() && !hovered) {
return cp->GetColor(ShouldShowVerticalTabs()
? kColorBraveSplitViewTileBackgroundVertical
: kColorBraveSplitViewTileBackgroundHorizontal);
return SK_ColorTRANSPARENT;
}

if (!ShouldShowVerticalTabs()) {
Expand All @@ -445,11 +443,11 @@ SkColor BraveVerticalTabStyle::GetTargetTabBackgroundColor(
}

if (tab()->IsActive()) {
return cp->GetColor(nala::kColorDesktopbrowserTabbarActiveTabVertical);
return cp->GetColor(kColorBraveVerticalTabActiveBackground);
}

if (hovered) {
return cp->GetColor(nala::kColorDesktopbrowserTabbarHoverTabVertical);
return cp->GetColor(kColorBraveVerticalTabHoveredBackground);
}

if (selection_state == TabStyle::TabSelectionState::kSelected) {
Expand Down
Loading