feat: user themes

[deploy]
This commit is contained in:
2023-07-23 23:01:21 +02:00
parent 5cdf969c6d
commit 7df75e109d
5 changed files with 75 additions and 6 deletions

View File

@@ -18,7 +18,7 @@
import "tippy.js/animations/shift-away.css"
import "tippy.js/dist/tippy.css"
import tippy from "tippy.js"
import {userPreferences} from "$lib/preferences.js"
import {theme, userPreferences} from "$lib/preferences.js"
if (browser) {
tippy.setDefaultProps({
@@ -33,11 +33,11 @@
export let data: LayoutServerData
onMount(async () => {
const theme = themeFromSourceColor(argbFromHex("#6D81C7"), [
{name: "success", value: argbFromHex("#00ff00"), blend: true},
])
const dark = true // window.matchMedia("(prefers-color-scheme: dark)").matches
applyTheme(theme, {target: document.body, dark})
theme.subscribe(it => {
const theme = themeFromSourceColor(argbFromHex(it.color))
const dark = it.mode === "dark" // window.matchMedia("(prefers-color-scheme: dark)").matches
applyTheme(theme, {target: document.body, dark})
})
initLocalStorage()
if (pwaInfo) {