Skip to content

Commit

Permalink
Merge pull request #27123 from brave/fix_private_window_vertical_tab_…
Browse files Browse the repository at this point in the history
…color

Fixed tab color regressions from #27008
  • Loading branch information
simonhong authored Jan 7, 2025
2 parents 704889c + 37e3465 commit 7b67331
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
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] = {
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

0 comments on commit 7b67331

Please sign in to comment.