summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-02-09 17:41:57 +0300
committerKirill Chibisov <contact@kchibisov.com>2022-02-10 03:17:21 +0300
commitd43196297da7fa458b94744ed3a18fe63adeec65 (patch)
treedd0468b82c22c29b093e4809018f036208cb1fb6
parent5c9fa470732b5742d6c14a89245007b6a8340f57 (diff)
downloadalacritty-d43196297da7fa458b94744ed3a18fe63adeec65.tar.gz
alacritty-d43196297da7fa458b94744ed3a18fe63adeec65.zip
Fix alpha when using `colors.transparent_background_colors`
The alpha is expected to be premultiplied from the text shader, so we should apply it to the background color.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/res/text.f.glsl4
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de90da0e..3e577a95 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `font.glyph_offset` is no longer applied on builtin font
- Buili-in font arcs alignment
- Repeated permission prompts on M1 macs
+- Colors being slightly off when using `colors.transparent_background_colors`
## 0.10.0
diff --git a/alacritty/res/text.f.glsl b/alacritty/res/text.f.glsl
index 5b4e3da6..3b8cd67c 100644
--- a/alacritty/res/text.f.glsl
+++ b/alacritty/res/text.f.glsl
@@ -18,7 +18,9 @@ void main() {
}
alphaMask = vec4(1.0);
- color = vec4(bg.rgb, bg.a);
+
+ // Premultiply background color by alpha.
+ color = vec4(bg.rgb * bg.a, bg.a);
} else if ((int(fg.a) & COLORED) != 0) {
// Color glyphs, like emojis.
vec4 glyphColor = texture(mask, TexCoords);