diff --git a/kitty/colors.c b/kitty/colors.c index aa105ff98..4eb3b4120 100644 --- a/kitty/colors.c +++ b/kitty/colors.c @@ -492,6 +492,20 @@ colorprofile_push_colors(ColorProfile *self, unsigned int idx) { return false; } +void +colorprofile_reset(ColorProfile *self) { + memcpy(self->color_table, self->orig_color_table, sizeof(FG_BG_256)); + self->dirty = true; + self->color_stack_idx = 0; + zero_at_ptr(&self->overridden); + for (unsigned i = 0; i < arraysz(self->overriden_transparent_colors); i++) { + zero_at_ptr(self->overriden_transparent_colors + i); + } + for (unsigned i = 0; i < self->color_stack_sz; i++) { + zero_at_ptr(self->color_stack + i); + } +} + bool colorprofile_pop_colors(ColorProfile *self, unsigned int idx) { if (idx == 0) { diff --git a/kitty/data-types.h b/kitty/data-types.h index 1264fe0ee..fec7ee97e 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -314,6 +314,7 @@ bool schedule_write_to_child_python(unsigned long id, const char *prefix, PyObje bool set_iutf8(int, bool); DynamicColor colorprofile_to_color(const ColorProfile *self, DynamicColor entry, DynamicColor defval); +void colorprofile_reset(ColorProfile *self); bool colorprofile_to_transparent_color(const ColorProfile *self, unsigned index, color_type *color, float *opacity); color_type colorprofile_to_color_with_fallback(ColorProfile *self, DynamicColor entry, DynamicColor defval, DynamicColor fallback, DynamicColor falback_defval); diff --git a/kitty/screen.c b/kitty/screen.c index 3d7a17c11..cd2adb1ef 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -210,9 +210,8 @@ screen_reset(Screen *self) { self->is_dirty = true; clear_all_selections(self); screen_cursor_position(self, 1, 1); - set_dynamic_color(self, 110, NULL); - set_dynamic_color(self, 111, NULL); - set_color_table_color(self, 104, NULL); + set_dynamic_color(self, 111, NULL); // does default_bg_changed processing + colorprofile_reset(self->color_profile); CALLBACK("on_reset", NULL) }