Menu
Libraries |
Category

svelte-themer

  • Purpose: A theming engine for Svelte apps using CSS Variables, with persistence support.
  • Key Features:
    • Generates CSS variables for themes using a structured nomenclature (e.g., --theme-text, --base-text).
    • Supports nested theme properties (e.g., --theme-light-colors-background).
    • Provides preset themes and allows custom theme creation.
    • Persists theme choices via localStorage.
    • Automatically loads themes based on user preference, OS settings, or a fallback.
  • Components:
    • ThemeWrapper: Manages theme context and persistence.
    • ThemeToggle: A convenience button for switching themes.
  • Target Audience: Svelte developers looking for a flexible and persistent theming solution.
  • Framework Support: Primarily for Svelte, with no mention of other frameworks.
  • Advanced Usage:
    • Custom toggle buttons can be created using the exposed toggle function from the theme context.
    • Actions like use:theme and use:stylesheet for applying themes to specific elements.
  • Theme Loading Order:
    1. User-provided theme.
    2. Saved theme (from localStorage).
    3. OS preference (prefers-color-scheme).
    4. Fallback (first theme in the list).

For more details, check the [GitHub repository](https://github.com/svelte-themer#readme fa-solid fa-up-right-from-square).

themecss-variablessveltetheming

Comments