From ec5343656531019319b4a64fcde26b88ff7b0dea Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Nov 2016 00:20:39 +0530 Subject: [PATCH] Restore set_color_table_color which was accidentally removed during the multiple windows refactor --- kitty/window.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kitty/window.py b/kitty/window.py index 1e299ae2f..aa51a4f59 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -17,7 +17,7 @@ from .fast_data_types import ( GLFW_KEY_RIGHT_SHIFT, glfw_post_empty_event ) from .terminfo import get_capabilities -from .utils import sanitize_title, get_primary_selection +from .utils import sanitize_title, get_primary_selection, parse_color_set class Window: @@ -117,6 +117,24 @@ class Window: self.char_grid.change_colors(color_changes) glfw_post_empty_event() + def set_color_table_color(self, code, value): + if code == 4: + for c, val in parse_color_set(value): + self.char_grid.color_profile.set_color(c, val) + self.refresh() + elif code == 104: + if not value.strip(): + self.char_grid.color_profile.reset_color_table() + else: + for c in value.split(';'): + try: + c = int(c) + except Exception: + continue + if 0 <= c <= 255: + self.char_grid.color_profile.reset_color(c) + self.refresh() + def request_capabilities(self, q): self.write_to_child(get_capabilities(q))