From 06c962359e54641025f4afb4fe19bb89686cc404 Mon Sep 17 00:00:00 2001 From: sameerasw Date: Fri, 10 Apr 2026 11:42:54 +0530 Subject: [PATCH 1/3] feat: Implement vibrancy --- patches/helium/macos/vibrancy.patch | 95 +++++++++++++++++++++++++++++ patches/series | 1 + 2 files changed, 96 insertions(+) create mode 100644 patches/helium/macos/vibrancy.patch diff --git a/patches/helium/macos/vibrancy.patch b/patches/helium/macos/vibrancy.patch new file mode 100644 index 0000000..69a40dc --- /dev/null +++ b/patches/helium/macos/vibrancy.patch @@ -0,0 +1,95 @@ +diff --git a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm +index 380a3c51c2ae0..7845dc78b4bb7 100644 +--- a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm ++++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm +@@ -429,8 +429,19 @@ void BrowserFrameViewMac::OnPaint(gfx::Canvas* canvas) { + return; + } + ++ canvas->DrawColor(SK_ColorTRANSPARENT); ++ + SkColor frame_color = GetFrameColor(BrowserFrameActiveState::kUseCurrent); +- canvas->DrawColor(frame_color); ++ SkColor transparent_tint = SkColorSetA(frame_color, 38); ++ ++ gfx::Rect contents_bounds = GetBrowserView()->contents_container()->bounds(); ++ contents_bounds = ++ views::View::ConvertRectToTarget(GetBrowserView(), this, contents_bounds); ++ ++ canvas->Save(); ++ canvas->ClipRect(contents_bounds, SkClipOp::kDifference); ++ canvas->DrawColor(transparent_tint); ++ canvas->Restore(); + + auto* theme_service = ThemeServiceFactory::GetForProfile( + GetBrowserView()->browser()->profile()); +diff --git a/chrome/browser/ui/views/frame/browser_widget.cc b/chrome/browser/ui/views/frame/browser_widget.cc +index d825bc7cb5828..064f9dbf8dda3 100644 +--- a/chrome/browser/ui/views/frame/browser_widget.cc ++++ b/chrome/browser/ui/views/frame/browser_widget.cc +@@ -157,6 +157,7 @@ void BrowserWidget::InitBrowserWidget() { + views::Widget::InitParams::CLIENT_OWNS_WIDGET); + params.name = "BrowserWidget"; + params.delegate = browser_view_; ++ params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent; + + Browser* browser = browser_view_->browser(); + if (browser->is_type_picture_in_picture()) { +diff --git a/chrome/browser/ui/views/frame/themed_background.cc b/chrome/browser/ui/views/frame/themed_background.cc +index f5f3d4e6c1cfa..ed893b91af2aa 100644 +--- a/chrome/browser/ui/views/frame/themed_background.cc ++++ b/chrome/browser/ui/views/frame/themed_background.cc +@@ -102,12 +102,7 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas, + const views::View* view, + const BrowserView* browser_view, + ThemeChoice theme_choice) { +- bool painted = +- PaintThemeCustomImage(canvas, view, browser_view, theme_choice); +- if (!painted) { +- canvas->DrawColor(view->GetColorProvider()->GetColor( +- GetThemeChoiceInfo(theme_choice, view).second)); +- } ++ canvas->DrawColor(SK_ColorTRANSPARENT); + } + + std::optional ThemedBackground::GetBackgroundColor( +diff --git a/chrome/browser/ui/views/side_panel/side_panel.cc b/chrome/browser/ui/views/side_panel/side_panel.cc +index e1cee41274339..9c8d986418391 100644 +--- a/chrome/browser/ui/views/side_panel/side_panel.cc ++++ b/chrome/browser/ui/views/side_panel/side_panel.cc +@@ -236,14 +236,7 @@ class ContentParentBackground : public views::Background { + SkRRect rrect; + rrect.setRectRadii(gfx::RectToSkRect(view->GetLocalBounds()), sk_radii); + SkPath path = SkPath::RRect(rrect); +- canvas->ClipPath(path, /*do_anti_alias=*/true); +- +- if (type_ == SidePanelEntry::PanelType::kToolbar) { +- ThemedBackground::PaintBackground(canvas, view, browser_view_); +- } else { +- canvas->DrawColor( +- view->GetColorProvider()->GetColor(kColorSidePanelBackground)); +- } ++ canvas->DrawColor(SK_ColorTRANSPARENT); + } + + private: +diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +index b89085a51a169..d87ef5bc43ae2 100644 +--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm ++++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +@@ -750,6 +750,15 @@ void NativeWidgetNSWindowBridge::CreateContentView( + [compositor_view setLayer:background_layer]; + [compositor_view setWantsLayer:YES]; + [bridged_view_ addSubview:compositor_view]; ++ if (is_translucent_window_) { ++ NSVisualEffectView* vibrancy_view = ++ [[NSVisualEffectView alloc] initWithFrame:[bridged_view_ bounds]]; ++ [vibrancy_view setMaterial:NSVisualEffectMaterialUnderWindowBackground]; ++ [vibrancy_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow]; ++ [vibrancy_view setState:NSVisualEffectStateActive]; ++ [vibrancy_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; ++ [bridged_view_ addSubview:vibrancy_view]; ++ } + + [bridged_view_ setWantsLayer:YES]; + if (corner_radius) { diff --git a/patches/series b/patches/series index 6129e4c..5b41348 100644 --- a/patches/series +++ b/patches/series @@ -10,6 +10,7 @@ helium/macos/change-product-dir-name.patch helium/macos/rust-dep.patch helium/macos/clean-main-menu.patch helium/macos/disable-immersive-fullscreen.patch +helium/macos/vibrancy.patch rebel/macos/sparkle-integration.patch helium/macos/updater/fixup-sparkle-glue.patch From c899f02cc1f560387d1817e0eb3631e7a49b30d9 Mon Sep 17 00:00:00 2001 From: sameerasw Date: Thu, 30 Apr 2026 17:08:20 +0530 Subject: [PATCH 2/3] feat: update vibrancy patch to conditionally preserve theme backgrounds in Zen mode sidebar --- patches/helium/macos/vibrancy.patch | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/patches/helium/macos/vibrancy.patch b/patches/helium/macos/vibrancy.patch index 69a40dc..eb194a1 100644 --- a/patches/helium/macos/vibrancy.patch +++ b/patches/helium/macos/vibrancy.patch @@ -39,7 +39,7 @@ diff --git a/chrome/browser/ui/views/frame/themed_background.cc b/chrome/browser index f5f3d4e6c1cfa..ed893b91af2aa 100644 --- a/chrome/browser/ui/views/frame/themed_background.cc +++ b/chrome/browser/ui/views/frame/themed_background.cc -@@ -102,12 +102,7 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas, +@@ -102,12 +102,19 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas, const views::View* view, const BrowserView* browser_view, ThemeChoice theme_choice) { @@ -49,6 +49,18 @@ index f5f3d4e6c1cfa..ed893b91af2aa 100644 - canvas->DrawColor(view->GetColorProvider()->GetColor( - GetThemeChoiceInfo(theme_choice, view).second)); - } ++ if (browser_view->IsZenModeEnabledForLayout() && ++ browser_view->ShouldDrawVerticalTabStrip() && ++ !browser_view->IsZenModeSideChromePinned()) { ++ bool painted = ++ PaintThemeCustomImage(canvas, view, browser_view, theme_choice); ++ if (!painted) { ++ canvas->DrawColor(view->GetColorProvider()->GetColor( ++ GetThemeChoiceInfo(theme_choice, view).second)); ++ } ++ return; ++ } ++ + canvas->DrawColor(SK_ColorTRANSPARENT); } @@ -57,7 +69,7 @@ diff --git a/chrome/browser/ui/views/side_panel/side_panel.cc b/chrome/browser/u index e1cee41274339..9c8d986418391 100644 --- a/chrome/browser/ui/views/side_panel/side_panel.cc +++ b/chrome/browser/ui/views/side_panel/side_panel.cc -@@ -236,14 +236,7 @@ class ContentParentBackground : public views::Background { +@@ -236,14 +236,15 @@ class ContentParentBackground : public views::Background { SkRRect rrect; rrect.setRectRadii(gfx::RectToSkRect(view->GetLocalBounds()), sk_radii); SkPath path = SkPath::RRect(rrect); @@ -69,6 +81,14 @@ index e1cee41274339..9c8d986418391 100644 - canvas->DrawColor( - view->GetColorProvider()->GetColor(kColorSidePanelBackground)); - } ++ if (browser_view_->IsZenModeEnabledForLayout() && ++ browser_view_->ShouldDrawVerticalTabStrip() && ++ !browser_view_->IsZenModeSideChromePinned()) { ++ canvas->DrawColor( ++ view->GetColorProvider()->GetColor(kColorSidePanelBackground)); ++ return; ++ } ++ + canvas->DrawColor(SK_ColorTRANSPARENT); } From 88ca581090b1649f780dcbb12e05f8dac76c409b Mon Sep 17 00:00:00 2001 From: sameerasw Date: Thu, 30 Apr 2026 18:25:16 +0530 Subject: [PATCH 3/3] refactor: add preference-based toggle to control vibrancy transparency in macOS frame rendering --- patches/helium/macos/vibrancy.patch | 58 ++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/patches/helium/macos/vibrancy.patch b/patches/helium/macos/vibrancy.patch index eb194a1..2da7163 100644 --- a/patches/helium/macos/vibrancy.patch +++ b/patches/helium/macos/vibrancy.patch @@ -2,10 +2,25 @@ diff --git a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm b/chrome/br index 380a3c51c2ae0..7845dc78b4bb7 100644 --- a/chrome/browser/ui/views/frame/browser_frame_view_mac.mm +++ b/chrome/browser/ui/views/frame/browser_frame_view_mac.mm -@@ -429,8 +429,19 @@ void BrowserFrameViewMac::OnPaint(gfx::Canvas* canvas) { +@@ -429,8 +429,36 @@ void BrowserFrameViewMac::OnPaint(gfx::Canvas* canvas) { return; } ++ auto* prefs = GetBrowserView()->browser()->profile()->GetPrefs(); ++ bool transparency_enabled = ++ prefs && prefs->GetBoolean(prefs::kHeliumTransparencyEnabled); ++ ++ if (!transparency_enabled) { ++ SkColor frame_color = GetFrameColor(BrowserFrameActiveState::kUseCurrent); ++ canvas->DrawColor(frame_color); ++ auto* theme_service = ThemeServiceFactory::GetForProfile( ++ GetBrowserView()->browser()->profile()); ++ if (!theme_service->UsingSystemTheme()) { ++ PaintThemedFrame(canvas); ++ } ++ return; ++ } ++ + canvas->DrawColor(SK_ColorTRANSPARENT); + SkColor frame_color = GetFrameColor(BrowserFrameActiveState::kUseCurrent); @@ -39,10 +54,25 @@ diff --git a/chrome/browser/ui/views/frame/themed_background.cc b/chrome/browser index f5f3d4e6c1cfa..ed893b91af2aa 100644 --- a/chrome/browser/ui/views/frame/themed_background.cc +++ b/chrome/browser/ui/views/frame/themed_background.cc -@@ -102,12 +102,19 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas, - const views::View* view, - const BrowserView* browser_view, - ThemeChoice theme_choice) { +@@ -5,10 +5,13 @@ + + #include + ++#include "chrome/browser/profiles/profile.h" + #include "chrome/browser/themes/theme_properties.h" + #include "chrome/browser/ui/color/chrome_color_id.h" + #include "chrome/browser/ui/views/frame/browser_view.h" + #include "chrome/browser/ui/views/tabs/tab_strip.h" ++#include "chrome/common/pref_names.h" + #include "chrome/grit/theme_resources.h" ++#include "components/prefs/pref_service.h" + #include "ui/base/theme_provider.h" + #include "ui/color/color_id.h" + #include "ui/color/color_provider.h" +@@ -102,12 +105,28 @@ void ThemedBackground::PaintBackground(gfx::Canvas* canvas, + const views::View* view, + const BrowserView* browser_view, + ThemeChoice theme_choice) { - bool painted = - PaintThemeCustomImage(canvas, view, browser_view, theme_choice); - if (!painted) { @@ -62,6 +92,13 @@ index f5f3d4e6c1cfa..ed893b91af2aa 100644 + } + + canvas->DrawColor(SK_ColorTRANSPARENT); ++ ++ // When transparency is disabled, fall back to an opaque frame color. ++ auto* prefs = browser_view->browser()->profile()->GetPrefs(); ++ if (prefs && !prefs->GetBoolean(prefs::kHeliumTransparencyEnabled)) { ++ canvas->DrawColor(view->GetColorProvider()->GetColor( ++ GetThemeChoiceInfo(theme_choice, view).second)); ++ } } std::optional ThemedBackground::GetBackgroundColor( @@ -69,7 +106,7 @@ diff --git a/chrome/browser/ui/views/side_panel/side_panel.cc b/chrome/browser/u index e1cee41274339..9c8d986418391 100644 --- a/chrome/browser/ui/views/side_panel/side_panel.cc +++ b/chrome/browser/ui/views/side_panel/side_panel.cc -@@ -236,14 +236,15 @@ class ContentParentBackground : public views::Background { +@@ -236,14 +236,24 @@ class ContentParentBackground : public views::Background { SkRRect rrect; rrect.setRectRadii(gfx::RectToSkRect(view->GetLocalBounds()), sk_radii); SkPath path = SkPath::RRect(rrect); @@ -89,6 +126,15 @@ index e1cee41274339..9c8d986418391 100644 + return; + } + ++ auto* prefs = browser_view_->browser()->profile()->GetPrefs(); ++ bool transparency_enabled = ++ prefs && prefs->GetBoolean(prefs::kHeliumTransparencyEnabled); ++ if (!transparency_enabled) { ++ canvas->DrawColor( ++ view->GetColorProvider()->GetColor(kColorSidePanelBackground)); ++ return; ++ } ++ + canvas->DrawColor(SK_ColorTRANSPARENT); }