comparison 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
comparison
equal deleted inserted replaced
28918:ec2988a3b03c 28919:99c1356f4210
6728 static int grey_ramp[] = { 6728 static int grey_ramp[] = {
6729 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, 6729 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76,
6730 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE 6730 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE
6731 }; 6731 };
6732 6732
6733 static char_u ansi_table[16][3] = { 6733 static const char_u ansi_table[16][3] = {
6734 // R G B 6734 // R G B
6735 { 0, 0, 0}, // black 6735 { 0, 0, 0}, // black
6736 {224, 0, 0}, // dark red 6736 {224, 0, 0}, // dark red
6737 { 0, 224, 0}, // dark green 6737 { 0, 224, 0}, // dark green
6738 {224, 224, 0}, // dark yellow / brown 6738 {224, 224, 0}, // dark yellow / brown
6757 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 6757 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15
6758 }; 6758 };
6759 #endif 6759 #endif
6760 6760
6761 #define ANSI_INDEX_NONE 0 6761 #define ANSI_INDEX_NONE 0
6762
6763 void
6764 ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
6765 {
6766 if (nr < 16)
6767 {
6768 *r = ansi_table[nr][0];
6769 *g = ansi_table[nr][1];
6770 *b = ansi_table[nr][2];
6771 *ansi_idx = nr;
6772 }
6773 else
6774 {
6775 *r = 0;
6776 *g = 0;
6777 *b = 0;
6778 *ansi_idx = ANSI_INDEX_NONE;
6779 }
6780 }
6762 6781
6763 void 6782 void
6764 cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx) 6783 cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
6765 { 6784 {
6766 int idx; 6785 int idx;