API Reference

setTheme

Programatically set the custom theme.

A function that sets the current custom theme, not to be confused with setMode, which sets the mode ('light', 'dark' or 'system').

The theme can be set to any arbitrary string value, and is persisted to localStorage and applied to the root html element via the data-theme attribute.

Usage

	<script lang="ts">
	import { setTheme } from "mode-watcher";
</script>
 
<button on:click={() => setTheme("dracula")}>Dracula Theme</button>
<button on:click={() => setTheme("retro")}>Retro Theme</button>	
MIT

© 2024 Svecosystem Team