about summary refs log tree commit diff
path: root/bskyembed/src/color-mode.ts
diff options
context:
space:
mode:
Diffstat (limited to 'bskyembed/src/color-mode.ts')
-rw-r--r--bskyembed/src/color-mode.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/bskyembed/src/color-mode.ts b/bskyembed/src/color-mode.ts
index 2b392c617..b34624e31 100644
--- a/bskyembed/src/color-mode.ts
+++ b/bskyembed/src/color-mode.ts
@@ -1,9 +1,15 @@
+export type ColorModeValues = 'system' | 'light' | 'dark'
+
+export function assertColorModeValues(value: string): value is ColorModeValues {
+  return ['system', 'light', 'dark'].includes(value)
+}
+
 export function applyTheme(theme: 'light' | 'dark') {
   document.documentElement.classList.remove('light', 'dark')
   document.documentElement.classList.add(theme)
 }
 
-export function initColorMode() {
+export function initSystemColorMode() {
   applyTheme(
     window.matchMedia('(prefers-color-scheme: dark)').matches
       ? 'dark'