diff options
author | Eric Bailey <git@esb.lol> | 2024-05-31 14:45:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 20:45:41 +0100 |
commit | 5cda807d9dcdbc5ed5dbb51a9c43123d60734c8a (patch) | |
tree | e080ec65e68779ef2027d5debf04971bec3ec439 /src/alf | |
parent | f868821cfcc87b62a320e5a1e11375fdb973adc1 (diff) | |
download | voidsky-5cda807d9dcdbc5ed5dbb51a9c43123d60734c8a.tar.zst |
Tweak avi follow button styles (#4304)
* Tighten up * Tweak colors * Tweak for night mode * Add missing file * Contrast plus
Diffstat (limited to 'src/alf')
-rw-r--r-- | src/alf/index.tsx | 8 | ||||
-rw-r--r-- | src/alf/themes.ts | 10 | ||||
-rw-r--r-- | src/alf/util/themeSelector.ts | 14 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/alf/index.tsx b/src/alf/index.tsx index f0a0ede7a..75ea28eb0 100644 --- a/src/alf/index.tsx +++ b/src/alf/index.tsx @@ -1,12 +1,14 @@ import React from 'react' import {Dimensions} from 'react-native' + import * as themes from '#/alf/themes' -export * from '#/alf/types' -export * as tokens from '#/alf/tokens' export {atoms} from '#/alf/atoms' -export * from '#/alf/util/platform' +export * as tokens from '#/alf/tokens' +export * from '#/alf/types' export * from '#/alf/util/flatten' +export * from '#/alf/util/platform' +export * from '#/alf/util/themeSelector' type BreakpointName = keyof typeof breakpoints diff --git a/src/alf/themes.ts b/src/alf/themes.ts index 0c95a459e..acfd269f8 100644 --- a/src/alf/themes.ts +++ b/src/alf/themes.ts @@ -1,11 +1,11 @@ +import {atoms} from '#/alf/atoms' import * as tokens from '#/alf/tokens' import type {Mutable} from '#/alf/types' -import {atoms} from '#/alf/atoms' import {BLUE_HUE, GREEN_HUE, RED_HUE} from '#/alf/util/colorGeneration' export type ThemeName = 'light' | 'dim' | 'dark' export type ReadonlyTheme = typeof light -export type Theme = Mutable<ReadonlyTheme> +export type Theme = Mutable<ReadonlyTheme> & {name: ThemeName} export type ReadonlyPalette = typeof lightPalette export type Palette = Mutable<ReadonlyPalette> @@ -193,7 +193,7 @@ export const dimPalette: Palette = { } as const export const light = { - name: 'light', + name: 'light' as ThemeName, palette: lightPalette, atoms: { text: { @@ -278,7 +278,7 @@ export const light = { } export const dark: Theme = { - name: 'dark', + name: 'dark' as ThemeName, palette: darkPalette, atoms: { text: { @@ -367,7 +367,7 @@ export const dark: Theme = { export const dim: Theme = { ...dark, - name: 'dim', + name: 'dim' as ThemeName, palette: dimPalette, atoms: { ...dark.atoms, 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}`) + } +} |