2022-08-06 13:26:25 +05:30
|
|
|
<script lang="ts">
|
|
|
|
import { afterUpdate } from "svelte";
|
|
|
|
import DarkMode from "svelte-dark-mode";
|
|
|
|
|
2022-09-16 19:35:27 +05:30
|
|
|
let theme: "dark" | "light";
|
2022-08-06 13:26:25 +05:30
|
|
|
|
|
|
|
afterUpdate(() => {
|
|
|
|
document.documentElement.className = theme;
|
|
|
|
});
|
|
|
|
|
|
|
|
let toggle = () => {
|
|
|
|
theme = theme === "dark" ? "light" : "dark";
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<DarkMode bind:theme />
|
|
|
|
|
2022-09-25 15:20:05 +05:30
|
|
|
<div on:click={toggle} class="cursor-pointer flex items-center">
|
|
|
|
<div class="i-fa6-solid:{theme === "dark" ? "sun" : "moon"}" />
|
|
|
|
<span class="ml-1 sm:hidden">Toggle theme</span>
|
|
|
|
</div>
|