feat: set terminal cursor color to match theme

This commit is contained in:
CJ van den Berg 2024-11-07 10:54:43 +01:00
parent 4360390b89
commit bf6e4f49b8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 10 additions and 3 deletions

View file

@ -30,8 +30,8 @@
.hash = "122019f077d09686b1ec47928ca2b4bf264422f3a27afc5b49dafb0129a4ceca0d01",
},
.vaxis = .{
.url = "https://github.com/neurocyte/libvaxis/archive/e1e3c61cdfa35a68e747685d1a245aa1d81d88f4.tar.gz",
.hash = "12206bacf76425efb2bda37c77b05e2ce13a18aa152d3b2264d2bcadb0941ba93ffc",
.url = "https://github.com/neurocyte/libvaxis/archive/ad953bc553f064c18e801745233cbebd6ca9d00c.tar.gz",
.hash = "122008a492174c4e5057df3cddc5b05c3864883952bf7cbb6f5c3902e3bf79549f3c",
},
.zeit = .{
.url = "https://github.com/rockorager/zeit/archive/9cca8ec620a54c3b07cd249f25e5bcb3153d03d7.tar.gz",

View file

@ -2,6 +2,7 @@ const std = @import("std");
const cbor = @import("cbor");
const log = @import("log");
const Style = @import("theme").Style;
const Color = @import("theme").Color;
const vaxis = @import("vaxis");
const builtin = @import("builtin");
@ -334,6 +335,10 @@ pub fn set_terminal_style(self: *Self, style_: Style) void {
self.vx.setTerminalBackgroundColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
}
pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
self.vx.setTerminalCursorColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
}
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
self.vx.setTerminalWorkingDirectory(self.tty.anyWriter(), absolute_path) catch {};
}

View file

@ -931,6 +931,8 @@ pub const fallbacks: []const FallBack = &[_]FallBack{
};
fn set_terminal_style(self: *Self) void {
if (self.config.enable_terminal_color_scheme)
if (self.config.enable_terminal_color_scheme) {
self.rdr.set_terminal_style(self.theme.editor);
self.rdr.set_terminal_cursor_color(self.theme.editor_cursor.bg.?);
}
}