From 07dbfaa2973a296bd1c8005dc4974f4599614ea5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 30 Apr 2023 08:28:02 +0530 Subject: [PATCH] Fix #6224 --- kitty/border_vertex.glsl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kitty/border_vertex.glsl b/kitty/border_vertex.glsl index 972bd2b8d..7a331db01 100644 --- a/kitty/border_vertex.glsl +++ b/kitty/border_vertex.glsl @@ -22,6 +22,14 @@ const uvec2 pos_map[] = uvec2[4]( uvec2(LEFT, TOP) ); +float linear2srgb(float x) { + // Linear to sRGB conversion. Needed to match alpha from the cell shader + float lower = 12.92 * x; + float upper = 1.055 * pow(x, 1.0f / 2.4f) - 0.055f; + + return mix(lower, upper, step(0.0031308f, x)); +} + float to_color(uint c) { return gamma_lut[c & FF]; } @@ -45,5 +53,5 @@ void main() { color3 = is_window_bg * window_bg + (1. - is_window_bg) * color3; float final_opacity = is_default_bg * tint_opacity + (1. - is_default_bg) * background_opacity; float final_premult_opacity = is_default_bg * tint_premult + (1. - is_default_bg) * background_opacity; - color = vec4(color3 * final_premult_opacity, final_opacity); + color = vec4(color3 * final_premult_opacity, linear2srgb(final_opacity)); }