MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / setTheme

Function setTheme

popup/helpers/theme.js:42–56  ·  view source on GitHub ↗
(themeKey)

Source from the content-addressed store, hash-verified

40}
41
42export function setTheme(themeKey) {
43 if (themeKey in THEME) {
44 currentThemeKey = themeKey;
45 themeSaver.set(themeKey);
46 cssTag.href = `themes/${themeKey}.less`;
47
48 // remove old compiled css
49 document.querySelector("style[id^=less]")?.remove?.();
50
51 // compile new css
52 less?.refresh?.();
53 } else {
54 alert("WRONG THEME KEY " + themeKey);
55 }
56}

Callers 2

initSettingsFunction · 0.90
theme.jsFile · 0.85

Calls 2

refreshMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected