Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new themeStore core module for managing theme state #1951

Merged
merged 17 commits into from
Jul 28, 2024

Conversation

sebnitu
Copy link
Owner

@sebnitu sebnitu commented Jul 28, 2024

What changed?

This PR adds the new themeStore core module for managing and maintaining theme state. It provides an API for setting a theme, adding and removing possible themes as well as callbacks for when the store is first initialized and when a theme changes. Theme state is persisted via local storage and theme classes are applied to the html element.

Additional changes

  • cssVar now takes an options param and allows setting a fallback value for when a CSS custom property is not found.
  • Adds prefix-themes to core css custom properties.
  • Applies new markup and logic to the vrembem package's vite demo including a theme toggle and VITE_PACKAGE variable.

@sebnitu sebnitu changed the title Add new themeStore for managing theme state Add new themeStore core module for managing theme state Jul 28, 2024
@sebnitu sebnitu marked this pull request as ready for review July 28, 2024 04:48
@sebnitu sebnitu merged commit f42d409 into next Jul 28, 2024
2 checks passed
@sebnitu sebnitu deleted the next-theme-switcher branch July 28, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant