No background color for nvim
Hi, i was gonna use your themes for neovim, but i found out that the background colors might not be set. Also when i use picom for background transparency with alacritty, the background for your themes in neovim is also transparent which shouldn't be.
themes in neovim is also transparent which shouldn't be.
What's the issue that it causes?
with alacritty,
This, a terminal emulator?
picom for background transparency
What is picom?
What's the issue that it causes?
The plug doesn't have background colors set for neovim, so there is some kind of default background (I can work around it by setting :hi Normal guibg=#xxxxxx)
This, a terminal emulator?
Yes that's the one
What is
picom?
A lightweight compositor for X11, so not having a background set results in the transparency of nvim
The plug doesn't have background colors set for neovim, so there is some kind of default background (I can work around it by setting :hi Normal guibg=#xxxxxx)
I understand that the background doesn't have colors being set.
I don't understand how not having the background color set is an issue.
Does it make the text unreadable or something else? Providing a screenshot would help.
Also what's your environment?
- Operating system
- Version of neovim
- terminal & version (I'll assume some version alacritty)
- Have you done anything special?
Does it make the text unreadable or something else? Providing a screenshot would help.
This is the rem colorscheme but the same thing happends with all of the colorschemes.
The first screenshot is without using picom for alacritty transparency and the second one is with picom.
- Operating system
I use Arch linux btw
- Version of neovim
0.7.2-3
- terminal & version (I'll assume some version alacritty)
alacritty 0.10.1
- Have you done anything special?
only installed picom for alacritty transparency
Okay, now I see why that is an issue.
I've got a few things that I'd like to finish before I look into this issue.
Sounds like you've got a manual work around for the time being. Feel free to submit a contribution (might be a while until I can look at it though).
Hi! At the moment, I can't install alacritty & picom to test it out myself. However, if you're using picom, you shouldn't be setting transparency with that, at least for alacritty. Picom really can't tell between background and content of your apps, it's going to make them transparent as a whole.
Instead, Alacritty has a built-in transparency feature, which is independent of any compositor. In the config file for Alacritty, you can add something similar to this:
## Terminal window settings
window:
dimensions:
columns: 82
lines: 24
padding:
x: 10
y: 10
decorations: full
startup_mode: Windowed
dynamic_title: true
## scrolling
history: 10000
multiplier: 3
## Background opacity
opacity: 0.4
the opacity value ranges from 0.0 (no background - transparency at 100%) and 1.0 (completely opaque).
You can try it out and share your results here.
@mlc-d Seems like the problem is not alacritty, nor using picom. It's just that the the themes are missing a background color and so the default background color of the given terminal emulator is used instead. The background colors should be defined so that the themes are consistent between different terminal emulator configurations.
@sproott you're absolutely right. There's an unused variable textEditorBackground in autoload/<theme>.vim. I took the time to add the following line to each colors/<theme>.vim file:
call s:h("Normal", {"bg": s:colors.textEditorBackground})
However, I didn't send the PR because there are some side effects. It looks like set background=[dark/light] is not present in any theme. The thing is, by default vim uses clear text on dark background, so for light themes it causes problems (light font on light theme). I took the time then to check each theme and add the proper line based on each colorscheme. Nonetheless, another problem arose: most terminal emulators have a default foreground color used for text. I wasn't able to override that variable (i don't know anything about vimscript), so if the terminal emulator has a, let's say, light grey font color, vim will use that for some snippets and fragments of code, and it can cause low contrast problems for a lot of themes.
For example, if I set the theme Aqua:

neovim running on a terminal emulator (alacritty) on the right. On the left, the Neovim-GTK app.
The call s:h("Normal", {"bg": s:colors.textEditorBackground}) works and now we have a nice #262940 background; however, the main font color is a light grey in alacritty, and bright white in nvim-gtk.
Another example, the theme Nakano Ichika:
The background is fine in both themes; but the font is another story. In Alacritty, it falls back to the default terminal foreground color, the same light grey we saw with the previous theme. And in Neovim-GTK, it uses a #000000 color. This is using set background=light. If I remove it, the output is the same, and if use set background=dark, it stays the same grey in alacritty and bright white for neovim-gtk.
So far, with Neovim-GTK it works great, no color/contrast problems whatsoever; but with proper terminal emulators (konsole, alacritty, gnome-terminal, etc), the problem persists. I might send the PR with the corrections I made looking at each theme, but the issue with the font falling back to tty's default still exists @Unthrottled And maybe someone else can actually make vim/neovim to not use the terminal font color, but another one specified in the theme file.
@mlc-d could you make your current work on this public?, I have some time to give it a try and get this working.