MCPcopy
hub / github.com/CodeboxIDE/codebox / changeTheme

Function changeTheme

client/core/themes.js:63–122  ·  view source on GitHub ↗
(themeId)

Source from the content-addressed store, hash-verified

61
62 // Change theme
63 var changeTheme = function(themeId) {
64 logger.log("try change theme", themeId, themes);
65 var cssContent, theme = themes[themeId];
66 if (!theme) return false;
67
68 if (themeId == currentTheme) return true;
69
70 logger.log("change theme", themeId);
71
72 // Set current theme
73 currentTheme = themeId;
74
75 cssContent = css.convertJSON(theme.styles, {
76 namespace: {
77 // scrollbar
78 'scrollbar': "::-webkit-scrollbar",
79 'scrollbar thumb': "::-webkit-scrollbar-thumb",
80 'scrollbar corner': "::-webkit-scrollbar-corner",
81
82 // menu bar
83 'menubar': ".cb-menubar",
84 'menubar button': ".cb-menubar .cb-commands-menubar .menu-command-item>.btn",
85
86 // statusbar
87 'statusbar': ".cb-statusbar",
88 'statusbar button': ".cb-statusbar .cb-commands-menubar .menu-command-item>.btn",
89
90 // lateral bar
91 'lateralbar': ".cb-lateralbar",
92 'lateralbar commands': ".cb-lateralbar .lateral-commands",
93 'lateralbar body': ".cb-panels",
94
95 // body
96 'body': ".cb-body",
97
98 // tabs
99 'tabs section': ".cb-tabs .section",
100 'tabs header': ".cb-tabs .tabs-section .tabs-section-header",
101 'tabs content': ".cb-tabs .tabs-section .tabs-section-content",
102 'tabs tab': ".component-tab",
103
104 // operations
105 'operations operation': ".cb-operations .operation-item",
106
107 // palette
108 'palette': ".cb-commands-palette",
109 'palette input': ".cb-commands-palette input",
110 'palette results': ".cb-commands-palette .results",
111 'palette results command': ".cb-commands-palette .results .command",
112
113 // alerts
114 'alerts': ".cb-alerts",
115 'alerts alert': ".cb-alerts .cb-alert"
116 },
117 base: "body #codebox"
118 });
119 $css.html(cssContent);
120

Callers 2

addThemeFunction · 0.85
updateCurrentThemeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected