@jill64/svelte-dark-theme

npm-version npm-license npm-download-month npm-min-size ci.yml website

☯ Dark Theme Manager for SvelteKit

▷ Installation
Device
'light'
$setting
'sync'
$theme
'light'
<!-- +layout.svelte -->
<script>
  import { ThemeManager } from '@jill64/svelte-dark-theme'
</script>

<ThemeManager />
<script>
  import { theme } from '@jill64/svelte-dark-theme'

  // current theme is 'light'
  console.log($theme)

  // current setting is 'sync'
  console.log($setting)

  const change_to_dark = () => {
    $theme = 'dark'
  }
</script>
// hooks.server.js
import { onRender } from '@jill64/svelte-dark-theme'
export const handle = onRender()