MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / add

Function add

src/theme/list.js:58–74  ·  view source on GitHub ↗

* * @param {ThemeBuilder} theme * @returns

(theme)

Source from the content-addressed store, hash-verified

56 * @returns
57 */
58function add(theme) {
59 if (!(theme instanceof ThemeBuilder)) return;
60 if (appThemes.has(theme.id)) return;
61
62 appThemes.set(theme.id, theme);
63
64 const { appTheme } = settings.value;
65
66 if (theme.matches(appTheme)) {
67 if (appTheme !== "system") {
68 apply(appTheme);
69 } else {
70 updateSystemTheme(isDeviceDarkTheme());
71 themeApplied = true;
72 }
73 }
74}
75
76/**
77 * Apply a theme

Callers 2

initFunction · 0.70
updateFunction · 0.70

Calls 5

updateSystemThemeFunction · 0.90
isDeviceDarkThemeFunction · 0.90
setMethod · 0.80
matchesMethod · 0.80
applyFunction · 0.70

Tested by

no test coverage detected