Merge pull request #17525 from lf-/hardcopy-truecolor

feat(hardcopy): check gui colours for highlights first
This commit is contained in:
bfredl
2022-02-26 23:57:27 +01:00
committed by GitHub

View File

@@ -386,18 +386,20 @@ static uint32_t prt_get_term_color(int colorindex)
return cterm_color_8[colorindex % 8]; return cterm_color_8[colorindex % 8];
} }
static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec) static uint32_t prt_get_color(int hl_id, int modec)
{ {
int colorindex; int colorindex;
uint32_t fg_color; uint32_t fg_color;
pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL); const char *color = highlight_color(hl_id, "fg#", 'g');
pattr->italic = (highlight_has_attr(hl_id, HL_ITALIC, modec) != NULL); if (color != NULL) {
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL); RgbValue rgb = name_to_color(color);
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL); if (rgb != -1) {
return (uint32_t)rgb;
}
}
{ color = highlight_color(hl_id, "fg", modec);
const char *color = highlight_color(hl_id, "fg", modec);
if (color == NULL) { if (color == NULL) {
colorindex = 0; colorindex = 0;
} else { } else {
@@ -409,8 +411,19 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
} else { } else {
fg_color = PRCOLOR_BLACK; fg_color = PRCOLOR_BLACK;
} }
return fg_color;
} }
static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
{
pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL);
pattr->italic = (highlight_has_attr(hl_id, HL_ITALIC, modec) != NULL);
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL);
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
uint32_t fg_color = prt_get_color(hl_id, modec);
if (fg_color == PRCOLOR_WHITE) { if (fg_color == PRCOLOR_WHITE) {
fg_color = PRCOLOR_BLACK; fg_color = PRCOLOR_BLACK;
} else if (*p_bg == 'd') { } else if (*p_bg == 'd') {