diff --git a/package.json b/package.json index 0f7e2f2ed09..7dec7ffd448 100644 --- a/package.json +++ b/package.json @@ -1156,6 +1156,116 @@ } } }, + "colors": [ + { + "id": "statusBarItem.vimMode.Normal", + "description": "Vim status bar color for normal mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.Insert", + "description": "Vim status bar color for insert mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.Visual", + "description": "Vim status bar color for visual mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.VisualBlock", + "description": "Vim status bar color for visual block mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.VisualLine", + "description": "Vim status bar color for visual line mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.Replace", + "description": "Vim status bar color for replace mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.EasyMotionMode", + "description": "Vim status bar color for easy motion mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.EasyMotionInputMode", + "description": "Vim status bar color for easy motion input mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.SurroundInputMode", + "description": "Vim status bar color for surround input mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.Disabled", + "description": "Vim status bar color for disabled mode.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.SearchInProgressMode", + "description": "Vim status bar color for when a search is in progress.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + }, + { + "id": "statusBarItem.vimMode.CommandlineInProgress", + "description": "Vim status bar color for when entering a command.", + "defaults": { + "dark": "statusBar.foreground", + "light": "statusBar.foreground", + "highContrast": "statusBar.foreground" + } + } + ], "languages": [ { "id": "Vimscript", diff --git a/src/statusBar.ts b/src/statusBar.ts index 66962988db8..a5cf998aa3b 100644 --- a/src/statusBar.ts +++ b/src/statusBar.ts @@ -70,11 +70,7 @@ class StatusBarImpl implements vscode.Disposable { } // StatusBar color - const shouldUpdateColor = - configuration.statusBarColorControl && vimState.currentMode !== this.previousMode; - if (shouldUpdateColor) { - this.updateColor(vimState.currentMode); - } + this.updateColor(vimState.currentMode); this.previousMode = vimState.currentMode; this.showingDefaultMessage = false; @@ -122,6 +118,23 @@ class StatusBarImpl implements vscode.Disposable { } private updateColor(mode: Mode) { + // original color update method - applies to the whole line by modifying the user's settings + if (configuration.statusBarColorControl && mode !== this.previousMode) { + this.updateWholeStatusBarColor(mode); + } + + // narrow color update method - applies to the Vim status bar items based on color settings + this.updateVimStatusBarItemColor(mode); + } + + private updateVimStatusBarItemColor(mode: Mode) { + const modeName = Mode[mode]; + const foregroundColor = new vscode.ThemeColor(`statusBarItem.vimMode.${modeName}`); + this.statusBarItem.color = foregroundColor; + this.recordedStateStatusBarItem.color = foregroundColor; + } + + private updateWholeStatusBarColor(mode: Mode) { let foreground: string | undefined; let background: string | undefined;