Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tsm/libtsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ struct tsm_screen_attr {
unsigned int inverse : 1; /* inverse colors */
unsigned int protect : 1; /* cannot be erased */
unsigned int blink : 1; /* blinking character */
unsigned int dim:1; /* dim color */
};

/* Attributes that alter the glyph shape */
Expand Down
10 changes: 10 additions & 0 deletions src/tsm/tsm-render.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb,
}
}

static void color_dim(struct tsm_screen_color *out, const struct tsm_screen_color *fg, const struct tsm_screen_color *bg)
{
out->r = bg->r / 2 + fg->r / 2;
out->g = bg->g / 2 + fg->g / 2;
out->b = bg->b / 2 + fg->b / 2;
}

/*
* tsm_screen_draw2 returns a pointer to a table of tsm_screen_cell, one for each cell on the screen.
* It uses a bit more memory, but should be much faster, as each cell is only 12 bytes.
Expand Down Expand Up @@ -287,6 +294,9 @@ const struct tsm_screen_cell *tsm_screen_draw2(struct tsm_screen *con)
out->bg.g = cell->attr.bg;
out->bg.b = cell->attr.bb;
}
if (cell->attr.dim)
color_dim(&out->fg, &out->fg, &out->bg);

if (sel_end && j == con->sel_end.x)
in_sel = !in_sel;
}
Expand Down
6 changes: 6 additions & 0 deletions src/tsm/tsm-vte.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ static void reset_state(struct tsm_vte *vte)
vte->saved_state.cattr.inverse = 0;
vte->saved_state.cattr.protect = 0;
vte->saved_state.cattr.blink = 0;
vte->saved_state.cattr.dim = 0;
}

static void save_state(struct tsm_vte *vte)
Expand Down Expand Up @@ -1332,10 +1333,14 @@ static void csi_attribute(struct tsm_vte *vte)
vte->cattr.underline = 0;
vte->cattr.inverse = 0;
vte->cattr.blink = 0;
vte->cattr.dim = 0;
break;
case 1:
vte->cattr.bold = 1;
break;
case 2:
vte->cattr.dim = 1;
break;
case 3:
vte->cattr.italic = 1;
break;
Expand All @@ -1350,6 +1355,7 @@ static void csi_attribute(struct tsm_vte *vte)
break;
case 22:
vte->cattr.bold = 0;
vte->cattr.dim = 0;
break;
case 23:
vte->cattr.italic = 0;
Expand Down
Loading