git bisect shows this commit as changing the colors of my terminal window.
See before and after images attached.
I can fix the problem with:
diff --git a/src/terminal.c b/src/terminal.c
index c7dc23f90..8bea9481a 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -2434,7 +2434,7 @@ color2index(VTermColor *color, int fg, int *boldp)
{
/* First 16 colors and default: use the ANSI index, because these
* colors can be redefined, we use the RGB values. */
- if (t_colors > 256)
+ if (t_colors >= 256)
return color->ansi_index;
switch (color->ansi_index)
{
As usual, feedback/explanation is appreciated. :)
I'm perfectly fine with that, but I'm at a loss for what should be
adjusted.
I'll poke around. If you have any suggestions, let me know!
Thanks,
Jason
I did a good bit of work to script up a demonstration of this problem.
I believe something is now broken with how Vim interprets custom color
palettes in 256-color terminal windows. I can reproduce the problem without
using my own .vim directory.
I wrote a short script (attached) to serve as a sanity check for how colors
are displayed in Vim terminal windows.
Again, my environment is GNOME Terminal on Ubuntu 18.04. In GNOME Terminal,
I have selected the Solarized font color palette for my profile. To make the
text more clear, you may want to use the Solaried dark background theme.
Other color palettes may be broken as well, but some appear to work
properly.
To reproduce:
0. Use solarized font palette in all terminal windows in GNOME Terminal
1. Compile latest vim (way after this patch, code here already changed)
2. ./vim --clean
3. :terminal, then run "colors" script to see the color table
4. open a second terminal window
5. run "colors" script in the new terminal window outside of vim
6. compare the tables
7. you'll see the tables are not the same, as they should be
In case your environment does not match mine, I have included screenshots of
the color table in both a Vim (./vim --clean) terminal window and in
a regular GNOME Terminal window.
I believe this issue, though it seems small, is important because it breaks
a really popular color scheme configuration.
Hopefully, you'll find the attached script useful, and it may give me some
direction. It could be that I need to go to the GNOME project to get
someone to work on this, but I believe the problem is here.
Thanks,
Jason Franklin
2019/5/14 Tue 5:58:30 UTC+9 Jason Franklin wrote:
> Bram,
>
> Thank you so much for taking the time to work with me on this.
>
> Unfortunately, I still can't get the colors to match on the latest build (patch 8.1.1330). I should note that the color scheme is much closer than it was before, but it looks like some of the colors are being modified when displayed in the Vim terminal window. The latest colors script still does not match in both cases.
>
> I have attached an updated version of the output of "colors" in both GNOME Terminal and in the Vim terminal window (vim at latest build).
>
> The point of interest is this: The color for yellow and for white is darker in the Vim terminal window. You can see this when positioning the screenshots side by side. I have noticed that other color schemes also show this same result (i.e., darker colors in Vim terminal). I will provide screenshots upon request. I don't know what might cause this... I did a git blame on the latest terminal.c file and I can't see anything with colors that seems odd.
>
> It may be that all of the colors here are slightly darker in the vim terminal window. It's so slight that it may be hard to tell. Again, a side-by-side comparison is the only way to really see this.
>
> I also want to note that showing bold text in bright colors has been disabled in GNOME Terminal.
>
> Thanks,
> Jason
I also noticed that the colors on Cygwin + mintty with 256-color mode are
wrong since 8.1.1146. Especially, yellow becomes brown.
The following patch seems to fix the problem:
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -2432,6 +2432,8 @@ color2index(VTermColor *color, int fg, i
if (color->ansi_index != VTERM_ANSI_INDEX_NONE)
{
+ if (t_colors == 256)
+ return color->ansi_index;
// The first 16 colors and default: use the ANSI index.
switch (color->ansi_index)
{
Regards,
Ken Takata