From 97bd8b127f1ad747a95a1239fca353c7c4ad4226 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Jun 2018 13:18:21 +0530 Subject: [PATCH] More conf docs --- kitty/config.py | 12 +----------- kitty/config_data.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/kitty/config.py b/kitty/config.py index 9f61e70fe..524331a72 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -14,7 +14,7 @@ from .conf.definition import as_conf_file from .conf.utils import ( init_config, key_func, load_config as _load_config, merge_dicts, parse_config_base, positive_int, python_string, to_bool, - to_cmdline, to_color, unit_float + to_cmdline, to_color ) from .config_data import all_options from .constants import cache_dir, defconf @@ -269,8 +269,6 @@ type_map = { 'macos_option_as_alt': to_bool, 'macos_titlebar_color': macos_titlebar_color, 'dynamic_background_opacity': to_bool, - 'background_opacity': unit_float, - 'dim_opacity': unit_float, 'window_alert_on_bell': to_bool, 'bell_on_tab': to_bool, 'kitty_mod': to_modifiers, @@ -278,16 +276,8 @@ type_map = { 'clipboard_control': lambda x: frozenset(x.lower().split()), } -for name in ( - 'foreground background ' - ' selection_foreground selection_background ' -).split(): - type_map[name] = to_color for i in range(256): type_map['color{}'.format(i)] = to_color -for a in ('active', 'inactive'): - for b in ('foreground', 'background'): - type_map['%s_tab_%s' % (a, b)] = to_color def special_handling(key, val, ans): diff --git a/kitty/config_data.py b/kitty/config_data.py index f3bece6f3..64f8c68f5 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -128,6 +128,7 @@ o, g, all_groups = option_func(all_options, { 'bell': [_('Terminal bell')], 'window': [_('Window layout')], 'tabbar': [_('Tab bar')], + 'colors': [_('Color scheme')], }) type_map = {o.name: o.option_type for o in all_options.values()} # }}} @@ -408,3 +409,35 @@ o('inactive_tab_background', '#999', option_type=to_color) o('inactive_tab_font_style', 'normal', option_type=tab_font_style) # }}} + +g('colors') # {{{ + +o('foreground', '#dddddd', option_type=to_color, long_text=_(''' +The foreground and background colors''')) +o('background', '#000000', option_type=to_color) + +o('background_opacity', 1.0, option_type=unit_float, long_text=_(''' +The opacity of the background. A number between 0 and 1, where 1 is opaque and +0 is fully transparent. This will only work if supported by the OS (for +instance, when using a compositor under X11). Note that it only sets the +default background color's opacity. This is so that things like the status bar +in vim, powerline prompts, etc. still look good. But it means that if you use +a color theme with a background color in your editor, it will not be rendered +as transparent. Instead you should change the default background color in your +kitty config and not use a background color in the editor color scheme. Or use +the escape codes to set the terminals default colors in a shell script to +launch your editor. Be aware that using a value less than 1.0 is a (possibly +significant) performance hit. If you want to dynamically change transparency +of windows set dynamic_background_opacity to yes (this is off by default as it +has a performance cost) +''')) +o('dynamic_background_opacity', False) + +o('dim_opacity', 0.75, option_type=unit_float, long_text=_(''' +How much to dim text that has the DIM/FAINT attribute set. One means no dimming and +zero means fully dimmed (i.e. invisible).''')) + +o('selection_foreground', '#000000', option_type=to_color, long_text=_(''' +The foreground and background for text selected with the mouse''')) +o('selection_background', '#FFFACD', option_type=to_color) +# }}}