about summary refs log tree commit diff
path: root/src/alf/util/themeSelector.ts
blob: c118b6506933a1ca5c3a89c00ef08af27830b874 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import {type ThemeName} from '#/alf/types'

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}`)
  }
}