Skip to content

Use custom theme colors in welcome preview - #39424

Open
aguscruiz wants to merge 5 commits into
masterfrom
new-onboarding-theme-improvements
Open

Use custom theme colors in welcome preview#39424
aguscruiz wants to merge 5 commits into
masterfrom
new-onboarding-theme-improvements

Conversation

@aguscruiz

@aguscruiz aguscruiz commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

When a non-default color theme is selected during onboarding, tint the mock browser chrome with toolbar.button.hover in light mode (horizontal and vertical tabs). Dark mode keeps chromeBackgroundDesktop. The selected swatch checkmark cut-out now uses container.background so it matches the page in both schemes.

  • Resolves

Test plan

  • Open the new welcome/onboarding appearance step in light mode
  • Confirm the default grey theme keeps the original chrome background
  • Select a color theme and confirm the preview chrome (frame, address bar, and vertical tab strip) tints
  • Switch tab layout between horizontal and vertical and confirm both previews tint
  • Switch to dark mode and confirm the chrome background does not change when selecting a color theme
  • Confirm the check-circle on the selected swatch is visible and matches the container background

@github-actions github-actions Bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Aug 26, 2026
@aguscruiz
aguscruiz requested a review from zenparsing August 26, 2026 19:54
@aguscruiz
aguscruiz enabled auto-merge (squash) August 26, 2026 19:54
Comment thread browser/resources/brave_welcome_page/components/browser_preview.tsx Outdated
@aguscruiz
aguscruiz disabled auto-merge August 26, 2026 20:56
The welcome page now detects custom theme colors and tints the browser mock chrome when the selected theme is light and not the default grey baseline. This also updates the theme color selector's inner dot styling to match the container background and adds a helper for checking whether a theme is a custom color theme.
Compute toolbar tint in AppearanceStep and pass it to BrowserPreview. AppearanceStep now imports theme_colors and derives tintToolbarBackground from useTheme; BrowserPreview accepts a tintToolbarBackground prop and no longer queries the welcome API or theme logic. Update CSS class name from "custom-theme-color" to "tint-toolbar-background" in browser_preview.style. Also clean up minor whitespace in theme_color_selector.style. This separates concerns (parent decides theming) and simplifies the preview component.
Mirror the browser's real chrome colors in the welcome-page preview by loading chrome://theme/colors.css and switching the preview styles to use theme CSS variables (with Nala fallbacks). Removes the tint-toolbar logic and the themeHasCustomColor helper; AppearanceStep no longer computes/passes tintToolbarBackground and BrowserPreview no longer accepts that prop. Keeps the preview in sync with the active window theme while preserving sensible fallbacks for Storybook.
@aguscruiz
aguscruiz force-pushed the new-onboarding-theme-improvements branch from 901cd45 to 18c00b2 Compare August 26, 2026 21:06
@brave-builds

Copy link
Copy Markdown
Collaborator

A Storybook has been deployed to preview UI for the latest push

<link rel="stylesheet" href="chrome://resources/brave/css/nala.css" blocking="render" >
<!-- The browser preview mirrors real browser chrome colors, which live in the
"chrome" color set. ColorChangeUpdater keeps this stylesheet in sync. -->
<link rel="stylesheet" href="chrome://theme/colors.css?sets=ui,chrome">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

BraveWelcomePageUI never does content::URLDataSource::Add(profile, std::make_unique<ThemeSource>(profile)) (browser/ui/webui/brave_welcome_page/brave_welcome_page_ui.cc), and chrome://theme is registered per-profile, not globally — the legacy BraveWelcomeUI adds it explicitly. Without it this stylesheet 404s and every --color-* lookup silently falls back to the Nala default, making the change a no-op unless some other WebUI in the profile happened to register the source first.

<link rel="stylesheet" href="chrome://resources/brave/fonts/inter.css" blocking="render" >
<link rel="stylesheet" href="chrome://resources/brave/css/nala.css" blocking="render" >
<!-- The browser preview mirrors real browser chrome colors, which live in the
"chrome" color set. ColorChangeUpdater keeps this stylesheet in sync. -->

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Drop comment.

}

&.vertical {
/* The vertical tab strip takes the toolbar color, as it does in the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Drop comment.

}

&.horizontal {
/* Horizontal tabs sit on the window frame rather than the toolbar. */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Drop comment.

// chrome://theme/colors.css. Using them keeps the preview in step with the
// window behind it, including the tint applied by the selected color theme.
// The Nala fallbacks are the browser's default values, and apply wherever
// colors.css is unavailable (e.g. Storybook).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reduce this comment. We only need a short explanation for where the CSS variables are coming from.

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

Labels

CI/storybook-url Deploy storybook and provide a unique URL for each build QA/No release-notes/exclude

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants