mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-15 13:04:38 +02:00
Remove a bunch of option processing code and directly define the threshold in the shader
This commit is contained in:
@@ -269,7 +269,7 @@ Then adjust the second parameter until it looks good. Then switch to a light the
|
||||
and adjust the first parameter until the perceived thickness matches the dark theme.
|
||||
''')
|
||||
|
||||
opt('text_fg_override_threshold', 0, option_type='float', ctype='percent', long_text='''
|
||||
opt('text_fg_override_threshold', 0, option_type='float', long_text='''
|
||||
The minimum accepted difference in luminance between the foreground and background
|
||||
color, below which kitty will override the foreground color. It is percentage
|
||||
ranging from :code:`0` to :code:`100`. If the difference in luminance of the
|
||||
|
||||
15
kitty/options/to-c-generated.h
generated
15
kitty/options/to-c-generated.h
generated
@@ -70,19 +70,6 @@ convert_from_opts_text_composition_strategy(PyObject *py_opts, Options *opts) {
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_text_fg_override_threshold(PyObject *val, Options *opts) {
|
||||
opts->text_fg_override_threshold = percent(val);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_opts_text_fg_override_threshold(PyObject *py_opts, Options *opts) {
|
||||
PyObject *ret = PyObject_GetAttrString(py_opts, "text_fg_override_threshold");
|
||||
if (ret == NULL) return;
|
||||
convert_from_python_text_fg_override_threshold(ret, opts);
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_cursor_shape(PyObject *val, Options *opts) {
|
||||
opts->cursor_shape = PyLong_AsLong(val);
|
||||
@@ -1083,8 +1070,6 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_text_composition_strategy(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_text_fg_override_threshold(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_shape(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_beam_thickness(py_opts, opts);
|
||||
|
||||
@@ -14,13 +14,6 @@ PyFloat_AsFloat(PyObject *o) {
|
||||
return (float)PyFloat_AsDouble(o);
|
||||
}
|
||||
|
||||
static inline float
|
||||
percent(PyObject *o) {
|
||||
float ans = PyFloat_AsFloat(o);
|
||||
return MAX(0.f, MIN(ans, 100.f)) * 0.01f;
|
||||
}
|
||||
|
||||
|
||||
static inline color_type
|
||||
color_as_int(PyObject *color) {
|
||||
if (!PyObject_TypeCheck(color, &Color_Type)) { PyErr_SetString(PyExc_TypeError, "Not a Color object"); return 0; }
|
||||
|
||||
Reference in New Issue
Block a user