示例#1
0
 def set_colors_to_current_theme(self) -> bool:
     if not self.themes_list and self.colors_set_once:
         return False
     self.colors_set_once = True
     if self.themes_list:
         o = self.themes_list.current_theme.kitty_opts
     else:
         o = create_default_opts()
     self.current_opts = o
     cmd = colors_as_escape_codes(o)
     self.write(cmd)
     return True
示例#2
0
文件: utils.py 项目: kovidgoyal/kitty
def kitty_opts() -> 'Options':
    from kitty.fast_data_types import get_options, set_options
    try:
        ans = cast(Optional['Options'], get_options())
    except RuntimeError:
        ans = None
    if ans is None:
        from kitty.cli import create_default_opts
        from kitty.utils import suppress_error_logging
        with suppress_error_logging():
            ans = create_default_opts()
            set_options(ans)
    return ans
示例#3
0
 def set_colors_to_current_theme(self) -> bool:
     if not self.themes_list and self.colors_set_once:
         return False
     self.colors_set_once = True
     if self.themes_list:
         o = self.themes_list.current_theme.kitty_opts
     else:
         o = create_default_opts()
     self.cmd.set_default_colors(
         fg=o.foreground, bg=o.background, cursor=o.cursor, select_bg=o.selection_background, select_fg=o.selection_foreground
     )
     self.current_opts = o
     cmds = []
     for i in range(256):
         col = color_as_sharp(color_from_int(o.color_table[i]))
         cmds.append(f'{i};{col}')
     self.print(end='\033]4;' + ';'.join(cmds) + '\033\\')
     return True
示例#4
0
def edit_config_file(args: List[str]) -> None:
    from kitty.cli import create_default_opts
    from kitty.fast_data_types import set_options
    from kitty.utils import edit_config_file as f
    set_options(create_default_opts())
    f()
示例#5
0
文件: utils.py 项目: phongnh/kitty
def kitty_opts() -> 'Options':
    from kitty.cli import create_default_opts
    from kitty.utils import suppress_error_logging
    with suppress_error_logging():
        return create_default_opts()
示例#6
0
文件: main.py 项目: Luflosi/kitty
def kitty_opts() -> Options:
    from kitty.cli import create_default_opts
    return create_default_opts()