mirror of
https://github.com/langgenius/dify.git
synced 2026-11-10 21:35:45 +08:00
Theme
This feature owns the color theme contract. It is the only Web module that imports next-themes; lint rejects that import everywhere else.
theme.tsowns theThemePreference(light,dark,system) andResolvedTheme(light,dark) types, and the option list (value, icon,commonlabel key) that every theme control renders in the same order.provider.tsxowns the provider configuration: thedata-themeattribute,systemas the default preference, and the CSP nonce.hooks.tsseparates the two questions a component can ask.useThemePreferencereturns what the user chose and is for theme controls.useResolvedThemereturns the light or dark value in effect and is for icons, editors, charts, and Marketplace links. A Marketplace link never receivessystem.theme-selector.tsxis the standalone icon menu for pages without the account menu.
Theme copy lives in the common namespace (theme.label, theme.light, theme.dark, theme.system) because console, share, auth, and Goto Anything surfaces all load it. Surface-specific descriptions stay with their surface.