Skip to content

Commit

Permalink
Fixed wrong active/hover tab bg color in private vertical tab
Browse files Browse the repository at this point in the history
fix brave/brave-browser#43057

This is regression from #27008

`nala::kColorDesktopbrowserTabbarActiveTabVertical` and
`nala::kColorDesktopbrowserTabbarHoverTabVertical`
didn't work for private/tor window.

Fixed by setting different colors for above in private/tor theme.
  • Loading branch information
simonhong committed Jan 7, 2025
1 parent b219fae commit 689e490
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 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 Down
20 changes: 15 additions & 5 deletions browser/ui/tabs/brave_tab_color_mixer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ void AddBraveTabThemeColorMixer(ui::ColorProvider* provider,
auto& mixer = provider->AddMixer();

mixer[kColorBraveVerticalTabActiveBackground] = {
kColorTabBackgroundInactiveFrameActive};
nala::kColorDesktopbrowserTabbarActiveTabVertical};
mixer[kColorBraveVerticalTabHoveredBackground] = {
nala::kColorDesktopbrowserTabbarHoverTabVertical};
mixer[kColorBraveVerticalTabInactiveBackground] = {kColorToolbar};
mixer[kColorBraveVerticalTabSeparator] = {kColorToolbarContentAreaSeparator};
mixer[kColorBraveVerticalTabNTBIconColor] = {
Expand Down Expand Up @@ -61,13 +63,17 @@ 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] = {
ui::AlphaBlend(kColorBraveVerticalTabActiveBackground,
kColorBraveVerticalTabInactiveBackground,
/* 40% opacity */ 0.4 * SK_AlphaOPAQUE)};
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorPrimitivePrivateWindow10};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
kColorBraveSplitViewTileBackgroundHorizontal};
nala::kColorPrimitivePrivateWindow5};
mixer[kColorBraveSplitViewTileDivider] = {
nala::kColorPrimitivePrivateWindow20};
}
Expand All @@ -76,13 +82,17 @@ 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] = {
ui::AlphaBlend(kColorBraveVerticalTabActiveBackground,
kColorBraveVerticalTabInactiveBackground,
/* 40% opacity */ 0.4 * SK_AlphaOPAQUE)};
mixer[kColorBraveSplitViewTileBackgroundHorizontal] = {
nala::kColorPrimitiveTorWindow10};
mixer[kColorBraveSplitViewTileBackgroundVertical] = {
kColorBraveSplitViewTileBackgroundHorizontal};
nala::kColorPrimitiveTorWindow5};
mixer[kColorBraveSplitViewTileDivider] = {nala::kColorPrimitiveTorWindow20};
}

Expand Down
4 changes: 2 additions & 2 deletions browser/ui/views/tabs/brave_tab_style_views.inc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,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

0 comments on commit 689e490

Please sign in to comment.