MCPcopy Create free account
hub / github.com/anomalyco/opencode / cacheThemeVariants

Function cacheThemeVariants

packages/ui/src/theme/context.tsx:162–172  ·  view source on GitHub ↗
(theme: DesktopTheme, themeId: string)

Source from the content-addressed store, hash-verified

160}
161
162function cacheThemeVariants(theme: DesktopTheme, themeId: string) {
163 if (themeId === "oc-2") return
164 for (const mode of ["light", "dark"] as const) {
165 const isDark = mode === "dark"
166 const variant = isDark ? theme.dark : theme.light
167 const tokens = resolveThemeVariant(variant, isDark)
168 const css = themeToCss(tokens)
169 const v2 = themeV2ToCss(resolveThemeVariantV2(variant, isDark))
170 write(isDark ? STORAGE_KEYS.THEME_CSS_DARK : STORAGE_KEYS.THEME_CSS_LIGHT, `${css}\n ${v2}`)
171 }
172}
173
174export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
175 name: "Theme",

Callers 3

onStorageFunction · 0.85
context.tsxFile · 0.85
setThemeFunction · 0.85

Calls 5

resolveThemeVariantFunction · 0.90
themeToCssFunction · 0.90
themeV2ToCssFunction · 0.90
resolveThemeVariantV2Function · 0.90
writeFunction · 0.70

Tested by

no test coverage detected