1
0
forked from aniani/vim

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 #10429,
            closes #7227 closes #10347)
This commit is contained in:
LemonBoy
2022-05-20 10:10:34 +01:00
committed by Bram Moolenaar
parent 1755a91851
commit b2b3acbf2b
9 changed files with 204 additions and 49 deletions

View File

@@ -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
@@ -6760,6 +6760,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)
{