@@ -204,8 +204,7 @@ export function setupOpenCloseTriggers(panel: Element, button_selector: string =
204
204
205
205
function setupThemes ( setting_panel : Element ) {
206
206
207
- let default_theme = < string > document . body . dataset . defaulttheme ;
208
- let active_theme = getLocalValue ( LocalStoreKeys . ActiveTheme ) || default_theme ;
207
+ let active_theme = getLocalValue ( LocalStoreKeys . ActiveTheme ) ;
209
208
210
209
//document.body.classList.add(active_theme);
211
210
let node = < HTMLTemplateElement > document . querySelector ( "#theme-entry-template" ) ;
@@ -219,13 +218,15 @@ function setupThemes(setting_panel: Element) {
219
218
let title = < HTMLElement > theme_entry . querySelector ( ".theme-entry-title" ) ;
220
219
let theme_entry_theme = < HTMLElement > theme_entry . querySelector ( ".theme" ) ;
221
220
222
- let { bg, mg , fg , target : target_class } = theme . dataset ;
221
+ let { text , bg, inner_border , inner_bg , border , target : target_class } = theme . dataset ;
223
222
224
- theme_entry . style . color = < string > fg ;
223
+ theme_entry . style . color = < string > text ;
225
224
theme_entry . style . backgroundColor = < string > bg ;
225
+ theme_entry . style . borderColor = < string > border ;
226
226
227
- theme_entry_theme . style . borderColor = < string > mg ;
228
- theme_entry_theme . style . backgroundColor = < string > fg ;
227
+ theme_entry_theme . style . borderColor = < string > inner_border ;
228
+ theme_entry_theme . style . backgroundColor = < string > inner_bg ;
229
+ title . style . color = < string > text
229
230
230
231
title . innerHTML = ( < string > target_class ) . replace ( / ^ ( \w ) | - ( \w ) / g, " <span style='text-transform:uppercase'>$1$2</span>" ) ;
231
232
@@ -234,22 +235,22 @@ function setupThemes(setting_panel: Element) {
234
235
let old_theme = active_theme ;
235
236
active_theme = < string > target_class ;
236
237
setLocalValue ( LocalStoreKeys . ActiveTheme , active_theme ) ;
237
- document . body . classList . replace ( old_theme , active_theme ) ;
238
- //document.body.classList.remove(old_theme);
238
+ if ( active_theme )
239
+ document . body . classList . add ( active_theme ) ;
240
+ if ( old_theme )
241
+ document . body . classList . remove ( old_theme ) ;
239
242
await sleep ( 400 ) ;
240
243
}
241
244
} ) ;
242
245
243
246
theme . parentElement ?. replaceChild ( theme_entry , theme ) ;
244
247
245
-
246
- if ( default_theme != active_theme ) {
247
- document . body . classList . replace ( default_theme , active_theme ) ;
248
+ if ( active_theme ) {
249
+ document . body . classList . add ( active_theme ) ;
248
250
}
249
251
250
-
251
252
return {
252
- theme_entry, bg, fg, target_class
253
+ theme_entry, bg, fg : inner_bg , target_class
253
254
} ;
254
255
} ) ;
255
256
}
0 commit comments