The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { |
| 2 | flattenThemeColor, |
| 3 | themeColorWithAlpha, |
| 4 | type MobileThemeMode, |
| 5 | type MobileThemeVariables, |
| 6 | } from "../lib/mobileTheme"; |
| 7 | |
| 8 | export interface WidgetPalette { |
| 9 | background: string; |
| 10 | foreground: string; |
| 11 | secondary: string; |
| 12 | track: string; |
| 13 | danger: string; |
| 14 | } |
| 15 | |
| 16 | export interface WidgetTheme { |
| 17 | mode: MobileThemeMode; |
| 18 | light: WidgetPalette; |
| 19 | dark: WidgetPalette; |
| 20 | } |
| 21 | |
| 22 | export function createWidgetTheme( |
| 23 | mode: MobileThemeMode, |
| 24 | palettes: Readonly<Record<"light" | "dark", MobileThemeVariables>>, |
| 25 | ): WidgetTheme { |
| 26 | const palette = (variables: MobileThemeVariables) => ({ |
| 27 | background: variables["--color-card"], |
| 28 | foreground: variables["--color-foreground"], |
| 29 | secondary: variables["--color-foreground-secondary"], |
| 30 | // Surface tokens can coincide; a foreground blend keeps the unfilled track visible. |
| 31 | track: flattenThemeColor( |
| 32 | themeColorWithAlpha(variables["--color-foreground"], 0.07), |
| 33 | variables["--color-card"], |
| 34 | ), |
| 35 | danger: variables["--color-danger-foreground"], |
| 36 | }); |
| 37 | return { mode, light: palette(palettes.light), dark: palette(palettes.dark) }; |
| 38 | } |