Output the set of special colors separately

This commit is contained in:
Kovid Goyal
2025-11-08 00:55:10 +05:30
parent aa7d38d5b1
commit 6c81547e24
2 changed files with 15 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ def main(args: list[str]=sys.argv) -> None:
from kitty.options.definition import definition
nullable_colors = []
all_colors = []
special_colors = []
for opt in definition.iter_all_options():
if callable(opt.parser_func):
match opt.parser_func.__name__:
@@ -50,14 +51,19 @@ def main(args: list[str]=sys.argv) -> None:
all_colors.append(opt.name)
case 'macos_titlebar_color' | 'titlebar_color' | 'scrollbar_color':
all_colors.append(opt.name)
special_colors.append(opt.name)
case 'to_color_or_none' | 'cursor_text_color':
nullable_colors.append(opt.name)
all_colors.append(opt.name)
nullable_colors.append(opt.name)
patch_color_list('tools/cmd/at/set_colors.go', nullable_colors, 'NULLABLE')
patch_color_list('tools/themes/collection.go', all_colors, 'ALL')
nc = ',\n '.join(f'{x!r}' for x in nullable_colors)
write_output('kitty', definition, f'\nnullable_colors = frozenset({{\n {nc}\n}})\n')
sc = ',\n '.join(f'{x!r}' for x in special_colors)
write_output('kitty', definition,
f'\nnullable_colors = frozenset({{\n {nc}\n}})\n'
f'\nspecial_colors = frozenset({{\n {sc}\n}})\n'
)
if __name__ == '__main__':

View File

@@ -1095,5 +1095,12 @@ nullable_colors = frozenset({
'selection_background'
})
special_colors = frozenset({
'scrollbar_handle_color',
'scrollbar_track_color',
'wayland_titlebar_color',
'macos_titlebar_color'
})
secret_options = ('remote_control_password', 'file_transfer_confirmation_bypass')