()
| 117 | } |
| 118 | |
| 119 | function ensureThemeStyleElement(): HTMLStyleElement { |
| 120 | const existing = document.getElementById(THEME_STYLE_ID) as HTMLStyleElement | null |
| 121 | if (existing) return existing |
| 122 | const element = document.createElement("style") |
| 123 | element.id = THEME_STYLE_ID |
| 124 | document.head.appendChild(element) |
| 125 | return element |
| 126 | } |
| 127 | |
| 128 | function getSystemMode(): "light" | "dark" { |
| 129 | if (typeof window !== "object") return "light" |