33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { IThemeService } from 'vs/platform/theme/common/themeService' ;
6+ import { IThemeService , registerThemingParticipant , ITheme , ICssStyleCollector } from 'vs/platform/theme/common/themeService' ;
77import { localize } from 'vs/nls' ;
88import { registerColor } from 'vs/platform/theme/common/colorRegistry' ;
99import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
1010import { IPartService , Parts } from 'vs/workbench/services/part/common/partService' ;
1111import { IDebugService , State } from 'vs/workbench/parts/debug/common/debug' ;
1212import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
13- import { STATUS_BAR_NO_FOLDER_BACKGROUND , STATUS_BAR_BACKGROUND , Themable } from 'vs/workbench/common/theme' ;
13+ import { STATUS_BAR_NO_FOLDER_BACKGROUND , STATUS_BAR_NO_FOLDER_FOREGROUND , STATUS_BAR_BACKGROUND , Themable , STATUS_BAR_FOREGROUND } from 'vs/workbench/common/theme' ;
14+ import { addClass , removeClass } from "vs/base/browser/dom" ;
1415
1516// colors for theming
1617
@@ -20,6 +21,12 @@ export const STATUS_BAR_DEBUGGING_BACKGROUND = registerColor('statusBar.debuggin
2021 hc : '#CC6633'
2122} , localize ( 'statusBarDebuggingBackground' , "Status bar background color when a program is being debugged. The status bar is shown in the bottom of the window" ) ) ;
2223
24+ export const STATUS_BAR_DEBUGGING_FOREGROUND = registerColor ( 'statusBar.debuggingForeground' , {
25+ dark : STATUS_BAR_FOREGROUND ,
26+ light : STATUS_BAR_FOREGROUND ,
27+ hc : STATUS_BAR_FOREGROUND
28+ } , localize ( 'statusBarDebuggingForeground' , "Status bar foreground color when a program is being debugged. The status bar is shown in the bottom of the window" ) ) ;
29+
2330export class StatusBarColorProvider extends Themable implements IWorkbenchContribution {
2431 private static ID = 'debug.statusbarColorProvider' ;
2532
@@ -45,25 +52,42 @@ export class StatusBarColorProvider extends Themable implements IWorkbenchContri
4552 protected updateStyles ( ) : void {
4653 super . updateStyles ( ) ;
4754
48- if ( this . partService . isVisible ( Parts . STATUSBAR_PART ) ) {
49- const container = this . partService . getContainer ( Parts . STATUSBAR_PART ) ;
50- container . style . backgroundColor = this . getColor ( this . getBackgroundColorKey ( ) ) ;
55+ const container = this . partService . getContainer ( Parts . STATUSBAR_PART ) ;
56+ if ( this . isDebugging ( ) ) {
57+ addClass ( container , 'debugging' ) ;
58+ } else {
59+ removeClass ( container , 'debugging' ) ;
5160 }
61+
62+ container . style . backgroundColor = this . getColor ( this . getColorKey ( STATUS_BAR_NO_FOLDER_BACKGROUND , STATUS_BAR_DEBUGGING_BACKGROUND , STATUS_BAR_BACKGROUND ) ) ;
63+ container . style . color = this . getColor ( this . getColorKey ( STATUS_BAR_NO_FOLDER_FOREGROUND , STATUS_BAR_DEBUGGING_FOREGROUND , STATUS_BAR_FOREGROUND ) ) ;
5264 }
5365
54- private getBackgroundColorKey ( ) : string {
66+ private getColorKey ( noFolderColor : string , debuggingColor : string , normalColor : string ) : string {
5567
56- // no debugging
57- if ( this . debugService . state === State . Inactive || this . isRunningWithoutDebug ( ) ) {
68+ // Not debugging
69+ if ( ! this . isDebugging ( ) ) {
5870 if ( this . contextService . hasWorkspace ( ) ) {
59- return STATUS_BAR_BACKGROUND ;
71+ return normalColor ;
6072 }
6173
62- return STATUS_BAR_NO_FOLDER_BACKGROUND ;
74+ return noFolderColor ;
75+ }
76+
77+ // Debugging
78+ return debuggingColor ;
79+ }
80+
81+ private isDebugging ( ) : boolean {
82+ if ( this . debugService . state === State . Inactive ) {
83+ return false ;
84+ }
85+
86+ if ( this . isRunningWithoutDebug ( ) ) {
87+ return false ;
6388 }
6489
65- // debugging
66- return STATUS_BAR_DEBUGGING_BACKGROUND ;
90+ return true ;
6791 }
6892
6993 private isRunningWithoutDebug ( ) : boolean {
@@ -75,4 +99,11 @@ export class StatusBarColorProvider extends Themable implements IWorkbenchContri
7599 public getId ( ) : string {
76100 return StatusBarColorProvider . ID ;
77101 }
78- }
102+ }
103+
104+ registerThemingParticipant ( ( theme : ITheme , collector : ICssStyleCollector ) => {
105+ const statusBarItemDebuggingForeground = theme . getColor ( STATUS_BAR_DEBUGGING_FOREGROUND ) ;
106+ if ( statusBarItemDebuggingForeground ) {
107+ collector . addRule ( `.monaco-workbench > .part.statusbar.debugging > .statusbar-item .mask-icon { background-color: ${ statusBarItemDebuggingForeground } !important; }` ) ;
108+ }
109+ } ) ;
0 commit comments