Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Granular Status Bar item color control #9232

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5fc9d3c
feat: directly color the vim mode status bar item
ColinMelendez Sep 1, 2024
caec000
dev: improved function naming consistency
ColinMelendez Sep 1, 2024
a011602
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 2, 2024
9473d07
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 3, 2024
3390518
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 4, 2024
9b670d3
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 9, 2024
1e7f2ef
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 12, 2024
268ee1f
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 16, 2024
926c7e0
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 25, 2024
13880d7
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Sep 29, 2024
014a0d9
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Oct 6, 2024
13ef832
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Oct 14, 2024
9077345
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Oct 23, 2024
0718f3c
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Oct 28, 2024
d74795b
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Nov 4, 2024
97e71f5
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Nov 27, 2024
789a553
Merge branch 'master' into feat-status-bar-item-color-control
ColinMelendez Dec 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 18 additions & 5 deletions src/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down