aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <wchibisovkirill@gmail.com>2019-09-26 17:10:54 +0300
committerChristian Duerr <contact@christianduerr.com>2019-09-26 16:10:54 +0200
commit9a0555bbba30c264f617ec9260ca00e0eab70870 (patch)
tree563b68da78a4948c089a935d3eefe890f9e8bccb
parentad24485cdb5a2b6559185c3c41adbf6852e5ac80 (diff)
downloadalacritty-9a0555bbba30c264f617ec9260ca00e0eab70870.tar.gz
alacritty-9a0555bbba30c264f617ec9260ca00e0eab70870.zip
Fix cell opacity when color matches terminal bg
Commit e964af8 introduced a regression, where if cell's bg color was equal to NamedColor::Background rgb color it was rendered with transparent background. However the correct behavior is to render bg transparent only when bg color is actually a NamedColor::Background. Fixes #2814.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty_terminal/src/term/mod.rs8
2 files changed, 6 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd802b39..c44551c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Block URL highlight while a selection is active
- Bindings for Alt + F1-F12
- Discard scrolling region escape with bottom above top
+- Opacity always applying to cells with their background color matching the teriminal background
### Removed
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 6829c7d0..258e4ebd 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -273,11 +273,13 @@ impl RenderableCell {
// Lookup RGB values
let mut fg_rgb = Self::compute_fg_rgb(config, colors, cell.fg, cell.flags);
let mut bg_rgb = Self::compute_bg_rgb(colors, cell.bg);
+ let mut bg_alpha = Self::compute_bg_alpha(cell.bg);
let selection_background = config.colors.selection.background;
if let (true, Some(col)) = (selected, selection_background) {
// Override selection background with config colors
bg_rgb = col;
+ bg_alpha = 1.0;
} else if selected ^ cell.inverse() {
if fg_rgb == bg_rgb && !cell.flags.contains(Flags::HIDDEN) {
// Reveal inversed text when fg/bg is the same
@@ -300,7 +302,7 @@ impl RenderableCell {
inner: RenderableCellContent::Chars(cell.chars()),
fg: fg_rgb,
bg: bg_rgb,
- bg_alpha: Self::compute_bg_alpha(colors, bg_rgb),
+ bg_alpha,
flags: cell.flags,
}
}
@@ -343,8 +345,8 @@ impl RenderableCell {
}
#[inline]
- fn compute_bg_alpha(colors: &color::List, bg: Rgb) -> f32 {
- if colors[NamedColor::Background] == bg {
+ fn compute_bg_alpha(bg: Color) -> f32 {
+ if bg == Color::Named(NamedColor::Background) {
0.
} else {
1.