Skip to content

Commit

Permalink
fix: 3350
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoon committed Jan 19, 2019
1 parent 5ac4331 commit 9936eab
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/statusBar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import { ModeName } from './mode/mode';
import { configuration } from './configuration/configuration';
import { logger } from 'neovim/lib/utils/logger';

class StatusBarImpl implements vscode.Disposable {
private _statusBarItem: vscode.StatusBarItem;
Expand Down Expand Up @@ -60,16 +61,11 @@ class StatusBarImpl implements vscode.Disposable {
}

private UpdateColor(mode: ModeName) {
let foreground;
let background;
let foreground : string | undefined = undefined;
let background : string | undefined = undefined;

let colorToSet = configuration.statusBarColors[ModeName[mode].toLowerCase()];

// If no color defined, fallback to normal mode color
if (colorToSet === undefined) {
colorToSet = configuration.statusBarColors[ModeName[ModeName.Normal].toLowerCase()];
}

if (colorToSet !== undefined) {
if (typeof colorToSet === 'string') {
background = colorToSet;
Expand All @@ -88,6 +84,13 @@ class StatusBarImpl implements vscode.Disposable {
'statusBar.foreground': `${foreground}`,
});

// if colors are undefined, return to vscode defaults
if (background === undefined) {
delete colorCustomizations['statusBar.background'];
delete colorCustomizations['statusBar.noFolderBackground'];
delete colorCustomizations['statusBar.debuggingBackground'];
}

if (foreground === undefined) {
delete colorCustomizations['statusBar.foreground'];
}
Expand Down

0 comments on commit 9936eab

Please sign in to comment.