Solarized color scheme and palette distorts for ssh'd users in iTerm2 - vim

My setup includes vim, iTerm2, tmux, and the solarized dark color scheme. I have the dark solarized color palette loaded into iTerm2 (modifies the ansi colors) and do not use the degraded solarized color scheme (i.e., let g:solarized_termcolors=256) as talked about in the readme as an alternative to using the color palette. Everything looks great.
But, I often remote pair with co-workers. Folks ssh into my machine from other instances of iTerm2 and sometimes Terminal.app and create a new tmux session with my tmux session as their base/parent session. In the case of iTerm2, their setup does not include loading the solarized color palette (one uses another palette entirely) and setting the let g:solarized_termcolors=256 to use the degraded solarized color scheme. If that's what they want, great, but when they connect to me via ssh/tmux the colors are lost and often times distorted to the point of being illegible.
Is there any combination of settings, besides having everyone use the same settings, to remedy this? Right now the recommendation is for me to use the degraded color scheme and not load the solarized color palette so that the ansi colors are not modified. This does work, but leaves me w/ the degraded solarized color scheme. And as I prefer the non-degraded solarized color scheme, I'd prefer not to take this approach.

When used in a terminal, the solarized colorscheme for Vim defaults to 16 colors and depends on the palette of the terminal emulator because it uses "Red", "Yellow"… as values for ctermfg and friends.
If you want the same colors everywhere you obviously need to have the same palette everywhere because your "Red" may not be someone else's "Red".
I don't know what the author smoked when he wrote it but let g:solarized_termcolors=256 is not "degraded" at all compared to the default. The default uses only a palette of 16 colors (dependant on the terminal's palette, as we have already seen) while this option makes it use a terminal-independant 256 colors palette. Because the colorscheme is not dependant on the terminal emulator's palette anymore, the colors are actually "guaranteed" to look "good" and "the same" on your terminal emulator and on someone else's terminal emulator.
The catch is that your terminal emulator and their terminal emulators must support 256 colors. All of todays terminals do, but the default is often set to 16 colors. It's generally easy to turn 256 colors support "on", though.
But this option is Vim-only. The colors of your prompt or of the output of some commands or of tmux's TUI may still feel "off" to your co-workers.
The ability to customize the hell out of your setup is of course an important aspect of the Vim experience. But customization comes at a price. You get used to many little things and it could happen that, confronted to a vastly different setup, well… you just get lost. Or, as happens to you, your setup is customized to the point of being unusable by your co-workers.
Pair programming can only work if you and your pair are able to reach compromise on a setup. Obviously, this setup may not be exactly yours or his but you must find a middle ground on which everyone agrees for pairing to work. Because you and your pair may use different versions of tmux/vim, different shells or different terminal emulators, the safest bet is to use the most basic setup possible. Unfortunately for you, solarized is too fragile and far from being "basic" enough.

Related

what is the difference between cterm color and gui color?

I am customizing my own color scheme for Vim but I don't know when should I configure ctermfg/ctermbg variable and guifg/guibg variable because I didn't see any differences between them at all. Is there any difference between them?
Can any one give me an illustrative example of how to use them ?
Thanks
I didn't see any differences between them at all
ctermxx is used by console version of Vim (when set notermguicolors). guixx is used in GVim, or in console if set termguicolors, and the console is capable of TrueColor, obviously. Hence you must test it in different programs to see the difference.
Also, some colors could be the same or very close to each other, e.g. "blue" is "blue" both in GUI and console.
Can any one give me an illustrative example of how to use them?
hi Normal guifg=#1034a6 guibg=#f5f5dc ctermfg=19 ctermbg=230
Should look very similar but still a little different in GUI and console
For symbolic colors names see :h cterm-colors and $VIMRUNTIME/rgb.txt. The cheat sheet of 256 color indexes for console is available here.
The separate pairs allow you to specify different colors for a terminal (which may limit you to a fixed-sized palette of colors, usually 16 or 256) and a GUI (which typically provides a much larger palette or even direct access to any color your display can handle).
For example, if you start a session in your terminal using vi some_file.txt, then ctermfg and ctermbg would be used. If you start an instance of gvim (which opens its own window independent of your terminal emulator), then guifg and guibg are used instead.

Vim using wrong colors

I have a problem with my vim and terminal configurations.
I am on Fedora Linux 27, run i3 and the gnome-terminal. I want to use the srcery color scheme (GH page). On GVim it works perfectly, right out the box. However, on the terminal it doesn't look as good. Srcery isn't the only color scheme with this issue, virtually all Base16 color schemes and all others that use 256 colors suffer from the same problem.
What I find bizarre, is that my $TERM variable is set to xterm-256color, tput colors gives out 256, and even vim itself claims to have a t_Co set to 256. I can do things like make the background of vim transparent, which then works properly.
you can see the color scheme working properly in GVim
a comparison to normal vim.
I have my gnome-terminal colors set to the srcery colors as well, there's a script on the GH page to create a srcery profile, which i am using. Alas, that does not help with my issue either.
Currently, I don't know how i could enable vim to correctly display my color scheme
Any help you could provide would be greatly, greatly appreciated.

Use arbitrary colors in Vim and terminator

I am working on terminal Vim colorscheme (for 256-color terminal) and I need a few dark colours that I could use as backgrounds. I'm not satisfied with ones available in standard palette - for example, color 22 (#005f00), the darkest shade of green, is still too bright.
I've read that terminal Vim does not allow specifying colors as RGB, so - to get arbitrary colors - I would have to tweak terminal emulator's color palette. Is there a way to tweak full 256-color palette in gnome-terminal / terminator? Preferences window only allows editing basic 16.
BTW, Chrome's hterm allows this via 'color-palette-overrides' preference (but has its own drawbacks).
Gnome-terminal doesn't offer a UI to alter the colors (apart from the first 16), but you can use escape sequences, e.g.:
echo -ne '\e]4;22;#004f00\a'
As you've mentioned, sometimes these colors get reset to their default values. This was a bug in the underlying VTE library, and got fixed in version 0.36.
As far as I know, you won't find a single terminal emulator that gives you that kind of control over the whole standardized xterm palette.
So, if you ever intend to share that colorscheme you are stuck with the default palette.
On the other hand, if that colorscheme is only meant for your usage or if you are OK with forcing a hard dependency on your users, you can use japh's colorcoke to generate an alternate palette more suited to your needs. See the repo's wiki for examples)

Are there conventions on which color combinations go well together?

Most terminal color palettes have colorschemes that are customizable.
Many terminal users make use of some standard colorscheme such as solarized.
I'm building a terminal application that needs to use colors.
My question is, how do I know which color combinations from the terminal color palette go well together?
For instance, in the colorschemes that I use, the last color in the palette generally serves well as an alternative background color, but I couldn't afford the risk that some text is hardly visible for someone else because of his different colorscheme.
Are there any conventions on this?

Why do all my MacVim color schemes look wrong?

I am having a problem with my MacVim color schemes. I have 'syntax on' in my .vimrc and I work mostly with Python.
As an example, I have attached a screenshot of what the "default" color scheme looks like in MacVim to me. I am having this problem with varying degrees of color differences for all the different schemes. Whenever I find a scheme I like online, it never looks like it does in the screenshot.
Any ideas on what the problem is?
Many themes provide modes for both dark background colors and light background colors. If you'd like to keep using this theme, try running:
:set background=light
Most of the themes I've seen were designed with a dark background and lighter text in mind -- I personally find a mostly-black screen easier on my eyes than a mostly-white screen -- so perhaps you just need to change the background color to something dark. In which case, you'd then want to run:
:set background=dark
The problem seems to be in ~/.gvimrc, look at what it does with the highlights (such as highlight NonText guibg=grey80). I've just placed them in an if !exists("stupid_colors").

Resources