feat: change default theme from system to light mode
This commit is contained in:
parent
b76637c14f
commit
785f077c50
2 changed files with 2 additions and 2 deletions
|
|
@ -340,7 +340,7 @@ const ThemeSelector = {
|
|||
window.addEventListener("phx:set-theme", () => this.updateActive())
|
||||
},
|
||||
updateActive() {
|
||||
const current = localStorage.getItem("phx:theme") || "system"
|
||||
const current = localStorage.getItem("phx:theme") || "light"
|
||||
this.el.querySelectorAll<HTMLElement>("[data-phx-theme]").forEach((btn) => {
|
||||
const isActive = btn.dataset.phxTheme === current
|
||||
btn.setAttribute("aria-pressed", isActive ? "true" : "false")
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
const getSystemTheme = () => mql.matches ? "dark" : "light";
|
||||
|
||||
const applyTheme = () => {
|
||||
const preference = localStorage.getItem("phx:theme") || "system";
|
||||
const preference = localStorage.getItem("phx:theme") || "light";
|
||||
const theme = preference === "system" ? getSystemTheme() : preference;
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue