diff --git a/kitty/cell_fragment.glsl b/kitty/cell_fragment.glsl index 8994f115e..30918c816 100644 --- a/kitty/cell_fragment.glsl +++ b/kitty/cell_fragment.glsl @@ -2,13 +2,11 @@ #pragma kitty_include_shader #pragma kitty_include_shader -#ifdef NEEDS_BACKROUND in vec3 background; in float draw_bg; #ifdef NEEDS_BG_ALPHA in float bg_alpha; #endif -#endif #ifdef NEEDS_FOREGROUND uniform sampler2DArray sprites; @@ -199,6 +197,7 @@ void main() { #if (PHASE == PHASE_FOREGROUND) vec4 text_fg = load_text_foreground_color(); + text_fg = adjust_foreground_contrast_with_background(text_fg, background); vec4 text_fg_premul = calculate_premul_foreground_from_sprites(text_fg); final_color = text_fg_premul; #ifdef TRANSPARENT diff --git a/kitty/cell_vertex.glsl b/kitty/cell_vertex.glsl index e6e5fec57..d49803e49 100644 --- a/kitty/cell_vertex.glsl +++ b/kitty/cell_vertex.glsl @@ -34,13 +34,11 @@ const uvec2 cell_pos_map[] = uvec2[4]( // }}} -#ifdef NEEDS_BACKROUND out vec3 background; out float draw_bg; #ifdef NEEDS_BG_ALPHA out float bg_alpha; #endif -#endif #ifdef NEEDS_FOREGROUND uniform float inactive_text_alpha; @@ -198,7 +196,6 @@ void main() { // }}} // Background {{{ -#ifdef NEEDS_BACKROUND float cell_has_non_default_bg = step(1, float(abs(bg_as_uint - default_colors[1]))); draw_bg = 1; @@ -235,7 +232,6 @@ void main() { #endif #endif -#endif // }}} } diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 0cbebdda3..45ab74980 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -276,9 +276,7 @@ foreground and background is below this threshold, the foreground color will be set to white if the background is dark or black if the background is light. The default value is :code:`0`, which means no overriding is performed. Useful when working with applications -that use colors that do not contrast well with your preferred color scheme. Note that this -will not work in situations where kitty has to render in multiple passes, for example, -when rendering with images under text or with non-opaque background and images. +that use colors that do not contrast well with your preferred color scheme. ''') egr() # }}} @@ -1352,21 +1350,24 @@ option_type='unit_float', ctype='float', long_text=''' The opacity of the background. A number between zero and one, where one is -opaque and zero is fully transparent. This will only work if supported by the OS -(for instance, when using a compositor under X11). Note that it only sets the -background color's opacity in cells that have the same background color as the -default terminal background, so that things like the status bar in vim, +opaque and zero is fully transparent. This will only work if supported by the +OS (for instance, when using a compositor under X11). Note that it only sets +the background color's opacity in cells that have the same background color as +the default terminal background, so that things like the status bar in vim, powerline prompts, etc. still look good. But it means that if you use a color theme with a background color in your editor, it will not be rendered as transparent. Instead you should change the default background color in your kitty config and not use a background color in the editor color scheme. Or use -the escape codes to set the terminals default colors in a shell script to launch -your editor. Be aware that using a value less than 1.0 is a (possibly -significant) performance hit. If you want to dynamically change transparency of -windows, set :opt:`dynamic_background_opacity` to :code:`yes` (this is off by -default as it has a performance cost). Changing this option when reloading the -config will only work if :opt:`dynamic_background_opacity` was enabled in the -original config. +the escape codes to set the terminals default colors in a shell script to +launch your editor. Be aware that using a value less than 1.0 is a (possibly +significant) performance hit. When using a low value for this setting, it is +desirable that you set the :opt:`background` color to a color the matches the +general color of the desktop background, for best text rendering. If you want +to dynamically change transparency of windows, set +:opt:`dynamic_background_opacity` to :code:`yes` (this is off by default as it +has a performance cost). Changing this option when reloading the config will +only work if :opt:`dynamic_background_opacity` was enabled in the original +config. ''' )