mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-05-19 04:08:53 +00:00
Use event listener for match system theme
This commit is contained in:
parent
836c13abec
commit
5d5d1bc3c1
1 changed files with 4 additions and 3 deletions
|
|
@ -512,14 +512,15 @@ Dribbblish.on("ready", () => {
|
|||
else dark = start <= time && time < end;
|
||||
toggleDark(dark);
|
||||
}
|
||||
if (theme === "system") {
|
||||
toggleDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
|
||||
}
|
||||
}
|
||||
|
||||
// Run every Minute to check time and set dark / light mode
|
||||
setInterval(checkDarkLightMode, 60000);
|
||||
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", e => {
|
||||
if (theme === "system") toggleDark(e.matches);
|
||||
});
|
||||
|
||||
Dribbblish.config.register({
|
||||
area: "Theme",
|
||||
type: "select",
|
||||
|
|
|
|||
Loading…
Reference in a new issue