Merge branch 'bg-alpha-on-default-bg-only'

This commit is contained in:
Daniel Eklöf 2021-05-04 10:46:33 +02:00
commit 3595d95c27
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 8 additions and 4 deletions

View file

@ -57,6 +57,8 @@
to launch (e.g. bad command line option) and -26/230 when the foot to launch (e.g. bad command line option) and -26/230 when the foot
server failed to instantiate a new window server failed to instantiate a new window
(https://codeberg.org/dnkl/foot/issues/466). (https://codeberg.org/dnkl/foot/issues/466).
* Background alpha no longer applied to palette or RGB colors that
matches the background color.
### Deprecated ### Deprecated

View file

@ -429,6 +429,8 @@ render_cell(struct terminal *term, pixman_image_t *pix,
uint32_t _fg = 0; uint32_t _fg = 0;
uint32_t _bg = 0; uint32_t _bg = 0;
bool apply_alpha = false;
if (is_selected && term->colors.use_custom_selection) { if (is_selected && term->colors.use_custom_selection) {
_fg = term->colors.selection_fg; _fg = term->colors.selection_fg;
_bg = term->colors.selection_bg; _bg = term->colors.selection_bg;
@ -441,12 +443,14 @@ render_cell(struct terminal *term, pixman_image_t *pix,
uint32_t swap = _fg; uint32_t swap = _fg;
_fg = _bg; _fg = _bg;
_bg = swap; _bg = swap;
} } else
apply_alpha = !cell->attrs.have_bg;
} }
if (unlikely(is_selected && _fg == _bg)) { if (unlikely(is_selected && _fg == _bg)) {
/* Invert bg when selected/highlighted text has same fg/bg */ /* Invert bg when selected/highlighted text has same fg/bg */
_bg = ~_bg; _bg = ~_bg;
apply_alpha = false;
} }
if (cell->attrs.dim) if (cell->attrs.dim)
@ -459,9 +463,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
pixman_color_t fg = color_hex_to_pixman(_fg); pixman_color_t fg = color_hex_to_pixman(_fg);
pixman_color_t bg = color_hex_to_pixman_with_alpha( pixman_color_t bg = color_hex_to_pixman_with_alpha(
_bg, _bg, apply_alpha ? term->colors.alpha : 0xffff);
(_bg == (term->reverse ? term->colors.fg : term->colors.bg)
? term->colors.alpha : 0xffff));
if (term->is_searching && !is_selected) { if (term->is_searching && !is_selected) {
color_dim_for_search(&fg); color_dim_for_search(&fg);