From 32e3ad50f4ad6b3664364437662989e938bf4e44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 8 Mar 2025 14:01:29 +0530 Subject: [PATCH] Recalc over luminance if changed by threshold so that gamma adjustment uses correct value --- kitty/cell_fragment.glsl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/cell_fragment.glsl b/kitty/cell_fragment.glsl index 7d0ef3dc8..5319a0904 100644 --- a/kitty/cell_fragment.glsl +++ b/kitty/cell_fragment.glsl @@ -94,6 +94,7 @@ vec4 foreground_contrast(vec4 over, vec3 under) { #if (FG_OVERRIDE == 1) over.rgb = fg_override(under_luminance, over_lumininace, over.rgb); + over_lumininace = dot(over.rgb, Y); #endif // Apply additional gamma-adjustment scaled by the luminance difference, the darker the foreground the more adjustment we apply. @@ -109,6 +110,7 @@ vec4 foreground_contrast_incorrect(vec4 over, vec3 under) { float over_lumininace = dot(over.rgb, Y); #if (FG_OVERRIDE == 1) over.rgb = fg_override(under_luminance, over_lumininace, over.rgb); + over_lumininace = dot(over.rgb, Y); #endif // This is the original gamma-incorrect rendering, it is the solution of the following equation: //