From 59f16f6b1568d95e7b183c75742c537b3f09a47d Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 9 Feb 2022 17:41:57 +0300 Subject: 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. --- CHANGELOG.md | 1 + alacritty/res/text.f.glsl | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93963d8b..83aa152e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,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); -- cgit