agenthub/frontend/lib/theme-keys.ts

13 lines
541 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 主题的存储键与默认值。单独一个不带 "use client" 的模块,是因为服务端组件
// (app/layout.tsx 的首屏脚本)也要用它:从 "use client" 模块往服务端 import 常量,
// 拿到的只是客户端引用代理,插进脚本字符串里会变成 "undefined"。
export type Theme = "dark" | "light";
export const THEME_STORE = "agenthub.theme";
export const DEFAULT_THEME: Theme = "dark";
export function isTheme(value: unknown): value is Theme {
return value === "dark" || value === "light";
}