diff --git a/docs/changelog.rst b/docs/changelog.rst index 71b19bdda..7acdf5576 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -136,7 +136,7 @@ Detailed list of changes - launch command: A new :option:`launch --bias` option to adjust the size of newly created windows declaratively (:iss:`7634`) -- A new option :opt:`second_transparent_bg` to make a second background color semi-transparent via :opt:`background_opacity`. Useful for things like cursor line highlight in editors (:iss:`7646`) +- A new option :opt:`transparent_background_colors` to make a second background color semi-transparent via :opt:`background_opacity`. Useful for things like cursor line highlight in editors (:iss:`7646`) - A new :doc:`notify ` kitten to show desktop notifications from the command line with support for icons, buttons and more. diff --git a/kitty/cell_vertex.glsl b/kitty/cell_vertex.glsl index fd9b39328..3cbd7317b 100644 --- a/kitty/cell_vertex.glsl +++ b/kitty/cell_vertex.glsl @@ -6,7 +6,7 @@ layout(std140) uniform CellRenderData { float xstart, ystart, dx, dy, sprite_dx, sprite_dy, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_fg, use_cell_for_selection_bg; - uint default_fg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted, second_transparent_bg; + uint default_fg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted; uint xnum, ynum, cursor_fg_sprite_idx; float cursor_x, cursor_y, cursor_w, cursor_opacity; diff --git a/kitty/options/definition.py b/kitty/options/definition.py index c54432108..6d33750e2 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -1527,16 +1527,22 @@ opt('background_image_linear', 'no', long_text='When background image is scaled, whether linear interpolation should be used.' ) -opt('transparent_background_colors', '', option_type='transparent_background_colors', ctype='!transparent_background_colors') +opt('transparent_background_colors', '', option_type='transparent_background_colors', ctype='!transparent_background_colors', long_text=''' +A space separated list of upto 7 colors, with opacity. When the background color of a cell matches one of these colors, +it is rendered semi-transparent using the specified opacity. -opt('second_transparent_bg', 'none', option_type='to_color_or_none', long_text=''' -When the background color matches this color, :opt:`background_opacity` is applied to it -to render it as semi-transparent, just as for colors matching the main :opt:`background` color. Useful in more complex UIs like editors where you could want more than a single background color -to be rendered as transparent, for instance, for a cursor highlight line background. +to be rendered as transparent, for instance, for a cursor highlight line background or a highlighted block. Terminal applications can set this color using :ref:`The kitty color control ` escape code. -''') + +The syntax for specifiying colors is: :code:`color@opacity`, where the :code:`@opacity` +part is optional. When unspecified, the value of :opt:`background_opacity` is used. For example:: + + transparent_background_colors red@0.5 #00ff00@0.3 + +''' +) opt('dynamic_background_opacity', 'no', option_type='to_bool', ctype='bool', diff --git a/kitty/shaders.c b/kitty/shaders.c index 7d70d01b8..c3af3907c 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -295,7 +295,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c struct GPUCellRenderData { GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_color, use_cell_for_selection_bg; - GLuint default_fg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted, second_transparent_bg; + GLuint default_fg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted; GLuint xnum, ynum, cursor_fg_sprite_idx; GLfloat cursor_x, cursor_y, cursor_w, cursor_opacity;