Vim colorscheme changes with terminal theme - vim

So this seems a bit odd to me, but I have a theme I made for vim, and when I change my terminal's colors, it changes the color in vim as well.
Here is the vim colorscheme with the matching terminal color scheme applied.
If I change the terminal color scheme to a light one, if changes my vim color scheme to this.
Here is my repo
https://github.com/mhartington/oceanic-next
Any idea whats up? This doesn't seem to happen in any other theme.

DISCLAIMER: I have to admit that I'm not very knowledgeable about this, so am very likely to be wrong, but in case this is not answered-
I believe terminal colorschemes map color-names to specific ansi codes. Vim themes can take colors in hex-codes or in numeric codes where number is from 0 to (number of colors supported by terminal - 1 ). Each of these colors would map to the color-names that the terminal has assigned, which in turn would map to ANSI codes. A terminal assignment of a color-code would depend on its theme. Its likely that your other themes give colors in hex codes.
Try running: http://www.vim.org/scripts/script.php?script_id=1349 with different terminal themes maybe and see?

Related

WSL: Installed colorscheme for terminal vim not working properly

I am a fairly new user of WSL and vim, and I wanted to install a new colorscheme for terminal vim. I do the standard steps: Create a ~/.vim/colors directory, then move the theme.vim files there. And when I open vim I can select them with :colorscheme, but the theme I get is entirely different from the one I installed. I have tried three different themes now and none of them have worked as expected.
Anyone one here knows what the cause of this could be?
Tl;dr: make sure the colorscheme fits your environment.
Vim colorschemes can have any of the following properties, alone or in combination…
8/16color-friendly colorschemes use the terminal emulator's 0-based 16 colours palette. Since various terminal emulators have different defaults and that palette is user-configurable it is impossible to predict accurately how it will look like.
You can expect these colorschemes to work reasonably well in most terminal emulators.
256color-friendly colorschemes use a semi-standardised 0-based 256 colours palette with the lower 16 indices corresponding to the aforementioned 16 colours palette. This means that colours 16 to 255 can reasonably be expected to look the same across modern terminal emulators.
You can expect these colorschemes to work well in many terminal emulators if your $TERM environment variable is set to something ending with 256color, xterm-256color being the most common correct value.
GUI-friendly colorschemes use hexadecimal values like in HTML/CSS for the best possible experience. If a colorscheme is GUI-friendly, it is automatically true-colors-friendly, which makes it suitable for use in terminal emulators that support the so-called "true color" feature.
If you use GUI Vim, then you don't have to worry about anything with these colorschemes. If you use Vim in a terminal emulator, then you will have to check if it supports the "true colors" feature and, if that's the case, enable it in Vim with :help 'termguicolors'.
Colorscheme authors are usually explicit about those things so you should be able to tell if a colorscheme fits your needs or not just by reading its README. If that is not the case, you can try looking for these hints in the code:
ctermbg and ctermfg only set to colour names or to numbers 0-15 means that the colorscheme is 8/16color-friendly.
Note that the name notation is more portable than the number notation.
ctermbg and ctermfg set to numbers 0-255 means that the colorscheme is 256color-friendly.
guibg and guifg present means that the colorscheme is GUI-friendly/true-color-friendly.

Solarized theme in OS X Terminal having brighter font colors compared to Vim

I have imported a Solarized theme for OS X Terminal created by Tomislav Filipčić (this is a port of Solarized for OS X 10.7+ terminals). I'm having a weird issue there. Font colors in the shell seem to be brighter than they should be in Solarized (they look washed-out), but colors in terminal Vim are fine (i also use Solarized for Vim, with no additional settings at all - just colorscheme solarized).
Below is the screenshot comparing shell font color and Vim color across different Tmux panes:
According to Tomislav (github issue), it is due to some color adjustment methods that Terminal employs.
I've also noticed that if Display ANSI colors checkbox is unchecked in Terminal Preferences, all colors, including the ones in Vim, become pale as in shell. Is there any way this issue can be addressed?
Thanks!
Switching to a different Solarized theme by Tayler Mulligan worked great. Now I do get proper colors, both in shell and Vim. I compared sRGB colour values against MacVim using OS X's Digital Color Meter, all values are identical. This solves the issue.

Vim + solarized + terminator = keywords highlighted in black

I started to configure vim so I installed pathogen and solarized.
Here is my .vimrc and the screenshot of the solarized theme at the same time.
I don't understand why I have keywords like 'set' highlighted in black?
Is it because of terminator?
It's the same problem when I open a python script, all the keywords are highlighted...
Thanks
EDIT
The real problem is that you can set different background/colors in vim, in zsh and also in terminator config. Is there a way to make it all looks like solarized? I think the problem comes from backgrounds that overlap each others. The black color is actually the background of terminator.
Colorscheme authors can build their own palette from a 16,777,216 colors palette for GUI colorschemes, the 256 colors xterm palette for 256-colors terminal emulators and the 16, user-configurable, named ANSI colors in other cases.
The obvious consequence is that it is extremely difficult to come up with a colorscheme that is guaranteed to look the same everywhere.
The choice I've made with my colorscheme was to only use colors from the xterm palette in the GUI version, making it virtually impossible to distinguish between terminal Vim and graphical Vim based on the colors alone. I honestly don't know how many colorschemes do that but the intrinsic limitations of that palette (no browns, for example) admittedly make that a bit complicated and restrictive.
For 8/16 colors terminals, I provide the values of 18 from my palette so that the user can customize his 16 ANSI colors and enjoy almost the same experience as with more capable terminals or GVim. This is something that every colorscheme author has to do and there's no workaround.
Some colorscheme authors start their work with a limited and arbitrary palette, often 16-20 colors, that they retrofit into their colorschemes. Since their palette is most of the time outside of the xterm palette, they are able to give you a pretty impressive out-of-the-box GUI experience but the 256-colors terminal experience is usually so-so, forcing you to retrograde your terminal to a xterm $TERM to enjoy the customized ANSI colors.

Vim syntax highlighting in terminal only affects the text background and not the text colour

I have just started using Vim in a terminal (PuTTY or MinTTY), after always using gVim. However, when using syntax highlighting, rather than the actual text colour changing appropriately, its background is changed to whatever colour -- and it looks horrible!
I've set my terminal to use 256 colours and downloaded a 256 colour colour scheme. I checked that the ctermfg and ctermbg settings are as I expect, but I still get this problem... Is this a Vim or a terminal configuration issue?
Many color schemes have features that are only supported in gvim/macvim. Some color schemes such as solarized, can be configured to support 256 color terminals using a setting such as let g:solarized_termcolors=256. For other color schemes, look at plugins like this one: http://www.vim.org/scripts/script.php?script_id=1809 and this one: http://www.vim.org/scripts/script.php?script_id=2390

Vim color schemes don't load anymore

Today I installed the last version of MacPorts on my laptop, since then (though I cannot be sure that this is the real cause) vim's color schemes don't load anymore. Instead, a strange black-and-white color scheme shows up, in which line numbers and reserved keywords are underlined.
If I try to change color scheme the syntax highlighting changes a bit, but still black and white.
Note that MacVim, which shares .vimrc with text-based vim, display the correct color scheme.
I have already tried relaxing file permissions on the colors and syntax directories in the vim directory.
Do you have any idea on what could have happened?
Thank you
Tunnuz
This sounds like an issue with vim's ability to detect if your terminal supports colors. Take a look at this from the vim documentation, specifically the second bullet point.

Resources