Skip to content

Commit

Permalink
Fix alpha when using colors.transparent_background_colors
Browse files Browse the repository at this point in the history
The alpha is expected to be premultiplied from the text shader, so
we should apply it to the background color.
  • Loading branch information
kchibisov authored Feb 9, 2022
1 parent 73c3dd8 commit 59f16f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion alacritty/res/text.f.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 59f16f6

Please sign in to comment.