Skip to content

feat: add zen.theme.transparent-content for full native transparency#13201

Open
xtraChizz wants to merge 1 commit intozen-browser:devfrom
xtraChizz:feature/improved-transparency
Open

feat: add zen.theme.transparent-content for full native transparency#13201
xtraChizz wants to merge 1 commit intozen-browser:devfrom
xtraChizz:feature/improved-transparency

Conversation

@xtraChizz
Copy link
Copy Markdown

Summary

Adds a new about:config preference zen.theme.transparent-content (default: false) that enables full transparency for web content areas.

Problem

Currently, even when browser.tabs.allow_transparent_browser is enabled and a page declares itself transparent, Zen still renders a semi-transparent overlay (rgba(255,255,255,0.4) in light mode / rgba(255,255,255,0.1) in dark mode) over the content area. This prevents the desktop wallpaper from showing through cleanly.

Extensions like Transparent Zen currently recommend users add a userChrome.css hack to work around this:

& browser[transparent="true"] {
  background: none !important;
}

Solution

This PR adds a native, preference-gated solution:

  1. prefs/zen/theme.yaml — Registers the new zen.theme.transparent-content boolean preference (default: false)
  2. src/zen/common/styles/zen-browser-container.css — When enabled, removes the semi-transparent background from browser[transparent="true"] containers
  3. src/zen/common/styles/zen-browser-ui.css — Reduces the browser background overlay opacity by 40% so the native window transparency (Mica/Acrylic on Windows, compositor on Linux) is more visible

How to test

  1. Enable browser.tabs.allow_transparent_browser in about:config
  2. Enable the appropriate platform transparency:
    • Windows: widget.windows.mica = true
    • Linux: zen.widget.linux.transparency = true
    • macOS: Works natively
  3. Set zen.theme.transparent-content to true
  4. Visit a website with the Transparent Zen extension or any page that sets transparent backgrounds
  5. The desktop wallpaper should show through cleanly without the white overlay

Before / After

  • Before: Semi-transparent white overlay covers content area even on transparent pages
  • After: Full transparency — desktop wallpaper visible through transparent web content

Notes

  • No existing behavior changes when the preference is false (default)
  • Uses the existing @media -moz-pref() pattern already used throughout the codebase
  • Addresses feedback from issue Transparency is weird on macOS #12303 (transparency weirdness) and community requests

Adds a new about:config preference `zen.theme.transparent-content`
(default: false) that enables full transparency for web content areas.

When enabled:
- Removes the semi-transparent background overlay from transparent
  browser containers (browser[transparent="true"]) so the desktop
  wallpaper shows through cleanly.
- Reduces the browser background overlay opacity by 40% to let the
  native window transparency effect (Mica/Acrylic on Windows,
  compositor transparency on Linux) be more visible.

This eliminates the need for the userChrome.css hack that extensions
like transparent-zen currently recommend to their users.
@xtraChizz xtraChizz requested a review from mr-cheffy as a code owner April 10, 2026 19:24
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Feature labels Apr 10, 2026
box-shadow: var(--zen-big-shadow);
}

& browser[type="content"] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should just add the pref check here?

* overlay opacity so the window's native transparency effect (Mica,
* Acrylic, or compositor transparency on Linux) is more visible. */
/* stylelint-disable-next-line media-query-no-invalid */
@media -moz-pref("zen.theme.transparent-content") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems rather unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants