Skip to content

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Jan 6, 2025

Supersedes #1076 — unlike that PR, this one prevents FOUC.

It also overhauls theme management in a few other ways:

  • adds a Persisted class which serves the same purpose as svelte-persisted-store, but without using stores
  • uses Persisted to create a Theme class
  • moves the blocking script into the ThemeToggle.svelte component

The result is that the code is more self-contained and easier to maintain. Eventually, we can probably get rid of the dependency on svelte-persisted-store altogether

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
svelte-dev ✅ Ready (Inspect) Visit Preview Jan 6, 2025 5:37pm

/>

<script>
document.documentElement.classList.add(
Copy link
Collaborator

Choose a reason for hiding this comment

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

You do need this to avoid/minimize the FOUC

Copy link
Member Author

Choose a reason for hiding this comment

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

no you don't, it's injected via ThemeToggle.svelte

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.

2 participants