MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / applyTheme

Function applyTheme

apps/ui/src/lib/theme/theme.utils.ts:35–49  ·  view source on GitHub ↗
(theme: ThemeName)

Source from the content-addressed store, hash-verified

33}
34
35export function applyTheme(theme: ThemeName): void {
36 if (typeof document === "undefined") {
37 return;
38 }
39
40 try {
41 document.documentElement.setAttribute(THEME_DATA_ATTRIBUTE, theme);
42 } catch (error) {
43 logger.warn({
44 event: "theme.set_failed",
45 theme,
46 error: getErrorMessage(error)
47 });
48 }
49}

Callers 2

useThemeFunction · 0.90

Calls 2

getErrorMessageFunction · 0.90
warnMethod · 0.80

Tested by

no test coverage detected