diff src/term.c @ 28919:99c1356f4210 v8.2.4982

patch 8.2.4982: colors in terminal window are not 100% correct Commit: https://github.com/vim/vim/commit/b2b3acbf2b3ae29ecf517f03b46fbeadf0c1a905 Author: LemonBoy <thatlemon@gmail.com> Date: Fri May 20 10:10:34 2022 +0100 patch 8.2.4982: colors in terminal window are not 100% correct Problem: Colors in terminal window are not 100% correct. Solution: Use g:terminal_ansi_colors as documented. (closes https://github.com/vim/vim/issues/10429, closes #7227 closes #10347)
author Bram Moolenaar <Bram@vim.org>
date Fri, 20 May 2022 11:15:04 +0200
parents d0241e74bfdb
children be6c32395444
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -6730,7 +6730,7 @@ static int grey_ramp[] = {
     0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE
 };
 
-static char_u ansi_table[16][3] = {
+static const char_u ansi_table[16][3] = {
 //   R    G    B
   {  0,   0,   0}, // black
   {224,   0,   0}, // dark red
@@ -6761,6 +6761,25 @@ static const char_u cterm_ansi_idx[] = {
 #define ANSI_INDEX_NONE 0
 
     void
+ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
+{
+    if (nr < 16)
+    {
+	*r = ansi_table[nr][0];
+	*g = ansi_table[nr][1];
+	*b = ansi_table[nr][2];
+	*ansi_idx = nr;
+    }
+    else
+    {
+	*r = 0;
+	*g = 0;
+	*b = 0;
+	*ansi_idx = ANSI_INDEX_NONE;
+    }
+}
+
+    void
 cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
 {
     int idx;