ThemePalette
app/features/theme/core/ThemePalette.tsNo overview comment at the top of the file.
- Imports
- no other modules
- Used by
- 2 actions1 route2 components
Types
export type ThemeInput = v.InferOutput<typeof themeInputSchema>;
Functions & values
export const DEFAULT_THEME_INPUT: ThemeInput = { baseHue: 268, baseChroma: 0.05, accentHue: 253, accentChroma: 0.24, bgLightness: THEME_INPUT_LIMITS.BG_LIGHTNESS_DEFAULT, chatHue: null, radiusBox: 3, radiusField: 2, radiusSelector: 2, borderWidth: 2, sizeField: 1,
Componentsapp/components/CustomThemeSelector.tsx
Expands the supporter's slider values into the CSS variables of a custom theme. Every text color is solved to have at least WCAG AA contrast against the surfaces it's shown on.
export function build(input: ThemeInput): CustomTheme
Unit tests (10)
Actions/settings/t/:customUrl/edit
Componentsapp/components/CustomThemeSelector.tsx
Recovers the slider values a stored custom theme was built from.
export function toThemeInput(theme: CustomTheme): ThemeInput
Unit tests (1)
Componentsapp/components/CustomThemeSelector.tsx
Serializes the slider values into a share code other users can paste into their theme selector.
export function toShareCode(input: ThemeInput): string
Componentsapp/components/CustomThemeSelector.tsx
Parses a share code made by toShareCode() (also older ones without the later added keys), returns null if it is not a valid theme.
export function fromShareCode(code: string): ThemeInput | null
Unit tests (3)
Componentsapp/components/CustomThemeSelector.tsx
Not shown, only used by tests: resolveColors, textContrastPairs