feat: add automatic dark/light mode support

This adds a new configuration option `light_theme` and support for automatically
switching the active dark/light theme from terminal events.

closes #302
This commit is contained in:
CJ van den Berg 2025-09-27 23:21:03 +02:00
parent 1ade0b1b89
commit a5d3eb18f3
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 68 additions and 22 deletions

View file

@ -346,7 +346,9 @@ pub fn process_renderer_event(self: *Self, msg: []const u8) Error!void {
if (self.dispatch_event) |f| f(self.handler_ctx, try self.fmtmsg(.{ "system_clipboard", text }));
},
.color_report => {},
.color_scheme => {},
.color_scheme => |scheme| {
if (self.dispatch_event) |f| f(self.handler_ctx, try self.fmtmsg(.{ "color_scheme", scheme }));
},
.winsize => |ws| {
if (!self.vx.state.in_band_resize) {
self.vx.state.in_band_resize = true;
@ -382,8 +384,11 @@ pub fn process_renderer_event(self: *Self, msg: []const u8) Error!void {
self.logger.print("rgb capability detected", .{});
self.vx.caps.rgb = true;
},
.cap_color_scheme_updates => {},
.cap_color_scheme_updates => {
self.logger.print("color scheme updates capability detected", .{});
self.vx.caps.color_scheme_updates = true;
self.vx.subscribeToColorSchemeUpdates(self.tty.anyWriter()) catch return error.TtyWriteError;
},
.cap_multi_cursor => {
self.logger.print("multi cursor capability detected", .{});
self.vx.caps.multi_cursor = true;