Files
Rental-operations-platform/contracts/phase9/implementation/theme-config_v1.0.ts
T
2026-06-25 19:06:59 -04:00

9 lines
725 B
TypeScript

export const themeCookie = "hpc-theme";
export const themeStorageKey = "hpc.theme.preference";
export const themePreferences = ["light","dark","system"] as const;
export type ThemePreference = typeof themePreferences[number];
export type ResolvedTheme = "light"|"dark";
export function isThemePreference(v:unknown): v is ThemePreference { return typeof v === "string" && (themePreferences as readonly string[]).includes(v); }
export function resolveTheme(preference:ThemePreference, systemDark:boolean):ResolvedTheme { return preference === "system" ? (systemDark ? "dark" : "light") : preference; }
export const themeCookieAttributes = { path:"/", sameSite:"lax" as const, maxAgeSeconds:31536000, secureInProduction:true };