Skip to content

fix(blog): apply data-theme on toggle for instant theme switch#4

Open
mulatta wants to merge 1 commit into
raskell-io:mainfrom
mulatta:fix-data-them
Open

fix(blog): apply data-theme on toggle for instant theme switch#4
mulatta wants to merge 1 commit into
raskell-io:mainfrom
mulatta:fix-data-them

Conversation

@mulatta

@mulatta mulatta commented Apr 13, 2026

Copy link
Copy Markdown

In blog/site mode, clicking the theme toggle only changes some text colors — the page background does not update until a full reload.

 function applyTheme(theme) {
   const effective = getEffectiveTheme(theme);
   document.documentElement.setAttribute('data-user-color-scheme', effective);
+  document.documentElement.setAttribute('data-theme', effective);
   document.documentElement.setAttribute('data-theme-setting', theme);
   ...
 }

This matches the inline script's behavior and the docs/book/product mode toggle
(theme.js), so background and palette colors update immediately on click.

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