@@ -37,6 +37,7 @@ export class CustomTitlebar extends ThemeBar {
37
37
}
38
38
39
39
private currentOptions : TitleBarOptions = {
40
+ backgroundColor : Color . WHITE ,
40
41
closeable : true ,
41
42
enableMnemonics : true ,
42
43
// hideWhenClickingClose: false,
@@ -396,25 +397,24 @@ export class CustomTitlebar extends ThemeBar {
396
397
: ACTIVE_FOREGROUND
397
398
}
398
399
399
- this . titlebar . style . color = foregroundColor . toString ( )
400
+ this . titlebar . style . color = foregroundColor ? .toString ( )
400
401
401
402
if ( this . menuBar ) {
402
403
let fgColor
403
- const backgroundColor = this . currentOptions . menuBarBackgroundColor ?? this . currentOptions . backgroundColor ? .darken ( 0.12 )
404
+ const backgroundColor = this . currentOptions . menuBarBackgroundColor || this . currentOptions . backgroundColor ! . darken ( 0.12 )
404
405
405
406
const foregroundColor = backgroundColor ?. isLighter ( )
406
407
? INACTIVE_FOREGROUND_DARK
407
408
: INACTIVE_FOREGROUND
408
409
409
- const bgColor = ! this . currentOptions . itemBackgroundColor || this . currentOptions . itemBackgroundColor . equals ( backgroundColor ! )
410
- ? DEFAULT_ITEM_SELECTOR
411
- : this . currentOptions . itemBackgroundColor
410
+ const bgColor = this . currentOptions . itemBackgroundColor && ! this . currentOptions . itemBackgroundColor . equals ( backgroundColor )
411
+ ? this . currentOptions . itemBackgroundColor
412
+ : DEFAULT_ITEM_SELECTOR
412
413
413
-
414
- if ( bgColor . equals ( DEFAULT_ITEM_SELECTOR ) ) {
414
+ if ( bgColor ?. equals ( DEFAULT_ITEM_SELECTOR ) ) {
415
415
fgColor = backgroundColor ?. isLighter ( ) ? ACTIVE_FOREGROUND_DARK : ACTIVE_FOREGROUND
416
416
} else {
417
- fgColor = bgColor . isLighter ( ) ? ACTIVE_FOREGROUND_DARK : ACTIVE_FOREGROUND
417
+ fgColor = bgColor ? .isLighter ( ) ? ACTIVE_FOREGROUND_DARK : ACTIVE_FOREGROUND
418
418
}
419
419
420
420
this . menuBar . setStyles ( {
@@ -549,6 +549,7 @@ export class CustomTitlebar extends ThemeBar {
549
549
* @param backgroundColor The color for the background
550
550
*/
551
551
public updateBackground ( backgroundColor : Color ) {
552
+ if ( typeof backgroundColor === 'string' ) backgroundColor = Color . fromHex ( backgroundColor )
552
553
this . currentOptions . backgroundColor = backgroundColor
553
554
this . updateStyles ( )
554
555
@@ -560,6 +561,7 @@ export class CustomTitlebar extends ThemeBar {
560
561
* @param itemBGColor The color for the item background
561
562
*/
562
563
public updateItemBGColor ( itemBGColor : Color ) {
564
+ if ( typeof itemBGColor === 'string' ) itemBGColor = Color . fromHex ( itemBGColor )
563
565
this . currentOptions . itemBackgroundColor = itemBGColor
564
566
this . updateStyles ( )
565
567
0 commit comments