diff --git a/kitty/cell_defines.glsl b/kitty/cell_defines.glsl index ec6459548..23b1ffd07 100644 --- a/kitty/cell_defines.glsl +++ b/kitty/cell_defines.glsl @@ -1,4 +1,3 @@ -#define DO_FG_OVERRIDE {DO_FG_OVERRIDE} #define FG_OVERRIDE_THRESHOLD {FG_OVERRIDE_THRESHOLD} #define FG_OVERRIDE_ALGO {FG_OVERRIDE_ALGO} #define TEXT_NEW_GAMMA {TEXT_NEW_GAMMA} @@ -25,5 +24,11 @@ #define ONLY_FOREGROUND #endif +#if FG_OVERRIDE_ALGO == 0 +#define DO_FG_OVERRIDE 0 +#else +#define DO_FG_OVERRIDE 1 +#endif + // Linear space luminance values const vec3 Y = vec3(0.2126, 0.7152, 0.0722); diff --git a/kitty/shaders/legacy.py b/kitty/shaders/legacy.py index 7fb10c3c9..144b6cad9 100644 --- a/kitty/shaders/legacy.py +++ b/kitty/shaders/legacy.py @@ -190,11 +190,13 @@ class LoadShaderPrograms: ) def resolve_cell_defines(only_fg: int, only_bg: int, src: str) -> str: + algo = '1' if self.text_fg_override_threshold.unit == '%' else '2' + if not self.text_fg_override_threshold.scaled_value: + algo = '0' r = self.cell_program_replacer.replacements r['ONLY_FOREGROUND'] = str(only_fg) r['ONLY_BACKGROUND'] = str(only_bg) - r['DO_FG_OVERRIDE'] = '1' if self.text_fg_override_threshold.scaled_value else '0' - r['FG_OVERRIDE_ALGO'] = '1' if self.text_fg_override_threshold.unit == '%' else '2' + r['FG_OVERRIDE_ALGO'] = algo r['FG_OVERRIDE_THRESHOLD'] = str(self.text_fg_override_threshold.scaled_value) r['TEXT_NEW_GAMMA'] = '0' if self.text_old_gamma else '1' return self.cell_program_replacer(src)