Skip to content

Circular reveal when switching the theme - #275

Merged
Bensge merged 1 commit into
masterfrom
feature/theme-toggle-reveal
Oct 2, 2026
Merged

Bensge merged 1 commit into
masterfrom
feature/theme-toggle-reveal

Conversation

@Bensge

@Bensge Bensge commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

What

Choosing Light, Dark or System in the theme popover now plays a circular reveal: the new theme grows out of the theme button as an expanding circle over the old one.

Demo

Circular theme reveal

The GIF is 11 real frames of the transition, captured by pausing the animation and stepping through it in roughly 70 ms increments, so it plays back slower than the real 0.6s animation.

How

  • theme.js: a theme picked by the user goes through applyThemeWithReveal, which wraps the existing applyTheme in document.startViewTransition and animates clip-path: circle(...) on ::view-transition-new(root) from the button's center out to the farthest corner. It applies instantly (as before) on initial load, on OS theme changes, when the effective light/dark theme would not change (e.g. System while already matching), when prefers-reduced-motion is set, and in browsers without view transitions.
  • styles.css: while the transition runs, html[data-theme-reveal] turns off the default root cross-fade and drops the view-transition-names that the tab-navigation transitions use, so the whole page (header, content, charts) is a single snapshot that the circle reveals.
  • CHANGELOG.md: added the entry.

Independent of #274 (the timeline image fix); it builds on the view-transition CSS already on master.

Testing

Built the image from this branch and ran it against a local Postgres. In Chrome I switched Light to Dark to Light: the theme changes, the data-theme-reveal marker is set during the switch and removed afterwards, localStorage is updated and there are no console errors. I also froze the animation mid-way and checked a screenshot: the dark theme is revealed through a circle centred on the theme button, including the nav and the charts.

I have not checked it in Safari. No automated tests added (browser-only behaviour).

🤖 Generated with Claude Code

…utton

Picking a theme in the popover now switches inside a same-document view
transition: the new theme is revealed through a circle that grows from the
theme button. The nav/page transition names from the tab transitions are
suspended for the duration so the whole page is one snapshot. Initial load,
OS theme changes, reduced motion, unsupported browsers and no-op switches
still apply the theme instantly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Kotlin Test Results

139 tests  ±0   139 ✅ ±0   37s ⏱️ +3s
 29 suites ±0     0 💤 ±0 
 29 files   ±0     0 ❌ ±0 

Results for commit e51c1dc. ± Comparison against base commit 4d7347d.

@Bensge
Bensge merged commit fa4af81 into master Oct 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant