A new option second_transparent_bg

Makes a second background color semi-transparent via background_opacity.
Useful for things like cursor line highlight in editors.

Fixes #7646
This commit is contained in:
Kovid Goyal
2024-07-21 20:22:31 +05:30
parent 573058d861
commit 0cf9a79760
25 changed files with 293 additions and 314 deletions

View File

@@ -179,14 +179,12 @@ class Foreground(Query):
@staticmethod
def get_result(opts: Options, window_id: int, os_window_id: int) -> str:
from kitty.fast_data_types import Color, get_boss
from kitty.fast_data_types import get_boss, get_options
boss = get_boss()
w = boss.window_id_map.get(window_id)
if w is None:
return opts.foreground.as_sharp
col = w.screen.color_profile.default_fg
r, g, b = col >> 16, (col >> 8) & 0xff, col & 0xff
return Color(r, g, b).as_sharp
return (w.screen.color_profile.default_fg or get_options().foreground).as_sharp
@query
@@ -196,15 +194,12 @@ class Background(Query):
@staticmethod
def get_result(opts: Options, window_id: int, os_window_id: int) -> str:
from kitty.fast_data_types import Color, get_boss
from kitty.fast_data_types import get_boss, get_options
boss = get_boss()
w = boss.window_id_map.get(window_id)
if w is None:
return opts.background.as_sharp
col = w.screen.color_profile.default_bg
r, g, b = col >> 16, (col >> 8) & 0xff, col & 0xff
return Color(r, g, b).as_sharp
return (w.screen.color_profile.default_bg or get_options().background).as_sharp
@query