about summary refs log tree commit diff
path: root/src/alf/util/themeSelector.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/alf/util/themeSelector.ts')
-rw-r--r--src/alf/util/themeSelector.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/alf/util/themeSelector.ts b/src/alf/util/themeSelector.ts
new file mode 100644
index 000000000..f484bc526
--- /dev/null
+++ b/src/alf/util/themeSelector.ts
@@ -0,0 +1,14 @@
+import {ThemeName} from '#/alf/themes'
+
+export function select<T>(name: ThemeName, options: Record<ThemeName, T>) {
+  switch (name) {
+    case 'light':
+      return options.light
+    case 'dark':
+      return options.dark || options.dim
+    case 'dim':
+      return options.dim || options.dark
+    default:
+      throw new Error(`select(theme, options) received unknown theme ${name}`)
+  }
+}