ui/src/theme/types.ts
Alois 8da8c99d5b
All checks were successful
/ deploy-and-package (push) Successful in 1m7s
(feat): improve fonts
(feat): make cards non-transparent
2026-07-30 20:19:55 +02:00

115 lines
2.9 KiB
TypeScript

import type * as React from "react";
export type ThemePolarity = "dark" | "light" | "system";
export type ResolvedThemePolarity = "dark" | "light";
export type ThemeTint = "soft" | "hard" | "extreme";
export type Base16Key =
| "base00"
| "base01"
| "base02"
| "base03"
| "base04"
| "base05"
| "base06"
| "base07"
| "base08"
| "base09"
| "base0A"
| "base0B"
| "base0C"
| "base0D"
| "base0E"
| "base0F";
export type Base16Palette = Record<Base16Key, string>;
export type ThemeFontFamily =
| "public-sans"
| "inter"
| "source-serif-4"
| "jetbrains-mono"
| "system";
export type ThemeDesign = {
density: number;
borderWidth: number;
shadowStrength: number;
fontScale: number;
headingWeight: number;
motion: number;
fontFamily: ThemeFontFamily;
};
export type ThemeDefaultValues = {
borderRadius: number;
design: ThemeDesign;
};
export type ThemePreset = {
id: string;
title: string;
logo: string;
css: string;
defaultValues?: ThemeDefaultValues;
};
export type ThemeProviderProps = {
children: React.ReactNode;
defaultTheme?: ThemePolarity;
defaultColor?: string;
defaultPalette?: Base16Palette | null;
defaultPrimaryColor?: string;
defaultTint?: ThemeTint;
defaultBorderRadius?: number;
defaultCustomCss?: string;
themes?: readonly ThemePreset[];
defaultParentThemeId?: string | null;
defaultDesign?: ThemeDesign;
storageKey?: string | null;
colorStorageKey?: string | null;
paletteStorageKey?: string | null;
primaryColorStorageKey?: string | null;
tintStorageKey?: string | null;
borderRadiusStorageKey?: string | null;
customCssStorageKey?: string | null;
parentThemeStorageKey?: string | null;
designStorageKey?: string | null;
disableTransitionOnChange?: boolean;
};
export type ThemeProviderState = {
theme: ThemePolarity;
setTheme: (theme: ThemePolarity) => void;
themeColor: string;
setThemeColor: (color: string) => void;
themePalette: Base16Palette | null;
setThemePalette: (palette: Base16Palette | null) => void;
themePrimaryColor: string;
setThemePrimaryColor: (color: string) => void;
themePolarity: ThemePolarity;
setThemePolarity: (polarity: ThemePolarity) => void;
resolvedPolarity: ResolvedThemePolarity;
themeTint: ThemeTint;
setThemeTint: (tint: ThemeTint) => void;
themeBorderRadius: number;
setThemeBorderRadius: (radius: number) => void;
themeCustomCss: string;
setThemeCustomCss: (css: string) => void;
themes: readonly ThemePreset[];
parentThemeId: string | null;
parentTheme: ThemePreset | null;
setParentThemeId: (id: string | null) => void;
applyThemePreset: (id: string) => void;
resetThemePreset: () => void;
isThemeCustomized: boolean;
themeDesign: ThemeDesign;
setThemeDesign: (
design: ThemeDesign | ((current: ThemeDesign) => ThemeDesign),
) => void;
};
export type HslColor = {
h: number;
s: number;
l: number;
};