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

Change status bar color based on mode #1056

Closed
brandonblock opened this issue Nov 12, 2016 · 20 comments · Fixed by #1529
Closed

Change status bar color based on mode #1056

brandonblock opened this issue Nov 12, 2016 · 20 comments · Fixed by #1529

Comments

@brandonblock
Copy link

I understand that this may not currently be possible with VS Code but the thing I'm missing most in switching from Vim is the color-indicated mode bar from lightline.

@johnfn
Copy link
Member

johnfn commented Nov 13, 2016

This is tracked on the vscode repo: microsoft/vscode#1884

@jnachtigall
Copy link

Something similar to these two vim plugins would be really nice:

For VSCodeVim another color when typing in a Search (e.g. /) would be nice. "Normal Mode" and "Searching for: " are really hard to differentiate as they are tiny and at very bottom and very left, whereas the code is more top right.

@zelphir
Copy link
Contributor

zelphir commented Apr 14, 2017

any updates? If is it not possible can you just append the statusbar-item div with a class? like normal-mode or insert-mode?

@xconverge
Copy link
Member

This is still experimental in vscode so was waiting a little bit for more adoption.

Just to get some feedback on this, would it be ok for something like this as config options:

vim.statusBarColorControl: true
vim.statusBarColors = {
    normal: "#268bd2"
    insert: "#d33682"
    visual: "#268bd2"
    visualline: "#2aa198"
    visualblock: "#859900"
    replace: "#b58900"
}

@zelphir
Copy link
Contributor

zelphir commented Apr 18, 2017

@xconverge Can I help you with?

@xconverge
Copy link
Member

I will take a stab at it tonight if I get a chance! I will let you know, one thing I do know is that I have 0 clue on what colors are used, that was going to be left up to the user. If you can pick some default colors though, that would be helpful.

@zelphir
Copy link
Contributor

zelphir commented Apr 18, 2017

there are no default colors! Everyone usually pick a color/theme for airline or lightline. Have a look here: https://github.com/itchyny/lightline.vim

As you can see it depends on the theme

@xconverge
Copy link
Member

Then how about these colors ;)

https://github.com/itchyny/lightline.vim#powerline-theme-default

@xconverge
Copy link
Member

Also, I think from the vscode implementation, the entire bar will change colors, so font color to read on it is going to be annoying, I will try it out and post some screenshots here for review though

@zelphir
Copy link
Contributor

zelphir commented Apr 18, 2017

It'd be great if you can customise theme in the settings using workbench.experimental.colorCustomizations... but that could be the next step.

@xconverge
Copy link
Member

It works :)

apr-18-2017 19-41-59

@13hoop
Copy link

13hoop commented May 6, 2017

works fine
ths.😄

@matthewsimo
Copy link

This seems to knock out my other theme color tweaks, is there a way to not blow out the other stuff in workbench.colorCustomizations? As an aside, would it be a nice feature to let users define a string of the color (and get current behavior) or an object of valid workbench.colorCustomizations key/value pairs (and get those values swapped in/out by mode)?

@xahon
Copy link

xahon commented Oct 29, 2017

Is it possible to change foreground color?

@xahon
Copy link

xahon commented Oct 29, 2017

there is "statusBar.foreground" option that works. May be someone made a PR?

@xahon
Copy link

xahon commented Oct 29, 2017

I've just added solution to change foreground in my PR #2102

@crucialfelix
Copy link

This works but it's a performance killer. Repaints are happening on every key stroke.

@xconverge
Copy link
Member

Let me take a peek and make sure it is only done on mode transitions

@crucialfelix
Copy link

I have a profile showing the keystrokes and the repaints. They stop when I change the status bar setting. Will post the profile tomorrow if you like.
You

@xconverge
Copy link
Member

xconverge commented Jul 9, 2018

I took a look this morning, it is definitely doing stuff every keystroke, not just on mode changes

my ONLY concern, is how to make sure things are really correct. For example, when switching tabs, it needs to accurately represent the new tabs state, so if one is in visual and one is in normal, how do we ensure things are all synced up and the proper color is displayed.

I think I have an idea, just cache the last mode in our statusBar singleton, and only do anything with color if newMode != oldMode

Will see if I can get a fix in tonight!

Edit: Yes looking at it, this should be very straight forward, something like this:

public SetColor(background: string, foreground?: string) {

Just add this to the top of SetColor() and also pass in the mode:

if(this._prevModeName === mode){
return;
}

We are already doing this in SetText more or less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants