Add an option to control background image tinting for window gaps
This commit is contained in:
parent
4290a8f9ba
commit
08d74a6c56
@ -49,6 +49,9 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
|
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
|
||||||
|
|
||||||
|
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
|
||||||
|
|
||||||
|
|
||||||
0.26.5 [2022-11-07]
|
0.26.5 [2022-11-07]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -1313,13 +1313,21 @@ this option by reloading the config is not supported.
|
|||||||
opt('background_tint', '0.0',
|
opt('background_tint', '0.0',
|
||||||
option_type='unit_float', ctype='float',
|
option_type='unit_float', ctype='float',
|
||||||
long_text='''
|
long_text='''
|
||||||
How much to tint the background image by the background color. This option
|
How much to tint the background image by the background color. This option
|
||||||
makes it easier to read the text. Tinting is done using the current background
|
makes it easier to read the text. Tinting is done using the current background
|
||||||
color for each window. This option applies only if :opt:`background_opacity` is
|
color for each window. This option applies only if :opt:`background_opacity` is
|
||||||
set and transparent windows are supported or :opt:`background_image` is set.
|
set and transparent windows are supported or :opt:`background_image` is set.
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
opt('background_tint_gaps', '1.0',
|
||||||
|
option_type='unit_float', ctype='float',
|
||||||
|
long_text='''
|
||||||
|
How much to tint the background image at the window gaps by the background
|
||||||
|
color, after applying :opt:`background_tint`.
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
opt('dim_opacity', '0.75',
|
opt('dim_opacity', '0.75',
|
||||||
option_type='unit_float', ctype='float',
|
option_type='unit_float', ctype='float',
|
||||||
long_text='''
|
long_text='''
|
||||||
|
|||||||
3
kitty/options/parse.py
generated
3
kitty/options/parse.py
generated
@ -84,6 +84,9 @@ class Parser:
|
|||||||
def background_tint(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def background_tint(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['background_tint'] = unit_float(val)
|
ans['background_tint'] = unit_float(val)
|
||||||
|
|
||||||
|
def background_tint_gaps(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
|
ans['background_tint_gaps'] = unit_float(val)
|
||||||
|
|
||||||
def bell_border_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def bell_border_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['bell_border_color'] = to_color(val)
|
ans['bell_border_color'] = to_color(val)
|
||||||
|
|
||||||
|
|||||||
15
kitty/options/to-c-generated.h
generated
15
kitty/options/to-c-generated.h
generated
@ -772,6 +772,19 @@ convert_from_opts_background_tint(PyObject *py_opts, Options *opts) {
|
|||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_python_background_tint_gaps(PyObject *val, Options *opts) {
|
||||||
|
opts->background_tint_gaps = PyFloat_AsFloat(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_opts_background_tint_gaps(PyObject *py_opts, Options *opts) {
|
||||||
|
PyObject *ret = PyObject_GetAttrString(py_opts, "background_tint_gaps");
|
||||||
|
if (ret == NULL) return;
|
||||||
|
convert_from_python_background_tint_gaps(ret, opts);
|
||||||
|
Py_DECREF(ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_from_python_dim_opacity(PyObject *val, Options *opts) {
|
convert_from_python_dim_opacity(PyObject *val, Options *opts) {
|
||||||
opts->dim_opacity = PyFloat_AsFloat(val);
|
opts->dim_opacity = PyFloat_AsFloat(val);
|
||||||
@ -1126,6 +1139,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_background_tint(py_opts, opts);
|
convert_from_opts_background_tint(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
|
convert_from_opts_background_tint_gaps(py_opts, opts);
|
||||||
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_dim_opacity(py_opts, opts);
|
convert_from_opts_dim_opacity(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_mark1_foreground(py_opts, opts);
|
convert_from_opts_mark1_foreground(py_opts, opts);
|
||||||
|
|||||||
2
kitty/options/types.py
generated
2
kitty/options/types.py
generated
@ -63,6 +63,7 @@ option_names = ( # {{{
|
|||||||
'background_image_linear',
|
'background_image_linear',
|
||||||
'background_opacity',
|
'background_opacity',
|
||||||
'background_tint',
|
'background_tint',
|
||||||
|
'background_tint_gaps',
|
||||||
'bell_border_color',
|
'bell_border_color',
|
||||||
'bell_on_tab',
|
'bell_on_tab',
|
||||||
'bell_path',
|
'bell_path',
|
||||||
@ -476,6 +477,7 @@ class Options:
|
|||||||
background_image_linear: bool = False
|
background_image_linear: bool = False
|
||||||
background_opacity: float = 1.0
|
background_opacity: float = 1.0
|
||||||
background_tint: float = 0
|
background_tint: float = 0
|
||||||
|
background_tint_gaps: float = 1.0
|
||||||
bell_border_color: Color = Color(255, 90, 0)
|
bell_border_color: Color = Color(255, 90, 0)
|
||||||
bell_on_tab: str = '🔔 '
|
bell_on_tab: str = '🔔 '
|
||||||
bell_path: typing.Optional[str] = None
|
bell_path: typing.Optional[str] = None
|
||||||
|
|||||||
@ -980,7 +980,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
|
|||||||
draw_bg(w);
|
draw_bg(w);
|
||||||
BLEND_ONTO_OPAQUE;
|
BLEND_ONTO_OPAQUE;
|
||||||
background_opacity = 1.0f;
|
background_opacity = 1.0f;
|
||||||
tint_opacity = OPT(background_tint);
|
tint_opacity = OPT(background_tint) * OPT(background_tint_gaps);
|
||||||
tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f;
|
tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ typedef struct {
|
|||||||
BackgroundImageLayout background_image_layout;
|
BackgroundImageLayout background_image_layout;
|
||||||
ImageAnchorPosition window_logo_position;
|
ImageAnchorPosition window_logo_position;
|
||||||
bool background_image_linear;
|
bool background_image_linear;
|
||||||
float background_tint, window_logo_alpha;
|
float background_tint, background_tint_gaps, window_logo_alpha;
|
||||||
|
|
||||||
bool dynamic_background_opacity;
|
bool dynamic_background_opacity;
|
||||||
float inactive_text_alpha;
|
float inactive_text_alpha;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user