3

I know that you can make the background-color transparent in Vim but can you also reduce the opacity of a color?

I tried doing something like this but no success:

highlight Normal ctermbg=000000CC
highlight NonText ctermbg=000000CC
Lambdaphile
  • 113
  • 1
  • 1
  • 9
  • This is typically not possible, because even terminals that allow you to use more than 256 colors (not all do!) typically only expose 24-color for RGB and no alpha channel. They usually only have a global alpha channel for the background, but not something an application running in the terminal can tweak... – filbranden Sep 08 '20 at 02:16

2 Answers2

3

This isn't possible in a terminal. The sequence to set a 24-bit color in the terminal provides values for red, green, and blue, but it doesn't provide an alpha channel. It may be that your terminal supports a custom escape sequence to set the opacity, but ncurses doesn't document any such sequence as standard. Even if your terminal does, that doesn't mean tmux or Vim can successfully invoke it.

What you can do is set your terminal to be transparent and then try not to set a background color, usually by setting the background color to NONE. Note that this is different than setting 0 as the background color, since that usually sets black as the background. For example, on my transparent terminal, running vim -u NONE causes Vim to draw a transparent background. That's the only option you have for something other than a completely opaque color.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • Yeah I kinda did that. I set my terminal to be transparent and then vim to not have background color and achieved transparency, but what I want is the nvim editor be a bit less transparent than the terminal. It would look pretty nice I think. What I did thus far is this: https://i1.lensdump.com/i/0WyuV9.png (transparent terminal/normal bg in vim). I mean if there's a trick which would let me give the background in nvim opacity it would be amazing :D – Lambdaphile Sep 08 '20 at 10:33
0

To avoid this issue, a way is to set the terminal's background image to an image that you create yourself, after reducing its exposure. You also need to set vim's background to transparent, so you see the terminal's background image that you just set.

Koedlt
  • 4,286
  • 8
  • 15
  • 33