@@ -655,23 +655,36 @@ export class SessionManager implements Middleware {
655
655
}
656
656
657
657
private setSessionStatus ( statusText : string , status : SessionStatus ) : void {
658
- // Set color and icon for 'Running' by default
659
- let statusIconText = ( semver . gte ( vscode . version , "1.56.0" ) )
660
- ? "$(terminal-powershell) "
661
- : "$(terminal) " ;
662
- let statusColor = "#affc74" ;
663
-
664
- if ( status === SessionStatus . Initializing ) {
665
- statusIconText = "$(sync) " ;
666
- statusColor = "#f3fc74" ;
667
- } else if ( status === SessionStatus . Failed ) {
668
- statusIconText = "$(alert) " ;
669
- statusColor = "#fcc174" ;
670
- }
671
-
672
658
this . sessionStatus = status ;
673
- this . statusBarItem . color = statusColor ;
674
- this . statusBarItem . text = statusIconText + statusText ;
659
+ switch ( status ) {
660
+ case SessionStatus . Running :
661
+ case SessionStatus . NeverStarted :
662
+ case SessionStatus . NotStarted :
663
+ // This icon is available since 1.56, now our current engine version.
664
+ this . statusBarItem . text = "$(terminal-powershell)" ;
665
+ // https://code.visualstudio.com/api/references/theme-color#status-bar-colors
666
+ this . statusBarItem . color = new vscode . ThemeColor ( "statusBar.foreground" ) ;
667
+ this . statusBarItem . backgroundColor = new vscode . ThemeColor ( "statusBar.background" ) ;
668
+ break ;
669
+ case SessionStatus . Initializing :
670
+ case SessionStatus . Stopping :
671
+ this . statusBarItem . text = "$(sync)" ;
672
+ // The warning colors were added later than our current engine version.
673
+ this . statusBarItem . color = ( semver . gte ( vscode . version , "1.59.0" ) )
674
+ ? new vscode . ThemeColor ( "statusBarItem.warningForeground" )
675
+ : new vscode . ThemeColor ( "statusBarItem.errorForeground" ) ;
676
+ this . statusBarItem . backgroundColor = ( semver . gte ( vscode . version , "1.59.0" ) )
677
+ ? new vscode . ThemeColor ( "statusBarItem.warningBackground" )
678
+ : new vscode . ThemeColor ( "statusBarItem.errorBackground" ) ;
679
+ break ;
680
+ case SessionStatus . Failed :
681
+ this . statusBarItem . text = "$(alert)" ;
682
+ // The error colors have been available since 1.53.
683
+ this . statusBarItem . color = new vscode . ThemeColor ( "statusBarItem.errorForeground" ) ;
684
+ this . statusBarItem . backgroundColor = new vscode . ThemeColor ( "statusBarItem.errorBackground" ) ;
685
+ break ;
686
+ }
687
+ this . statusBarItem . text += " " + statusText ;
675
688
}
676
689
677
690
private setSessionFailure ( message : string , ...additionalMessages : string [ ] ) {
0 commit comments