diff --git a/res/config.ini b/res/config.ini index 2738c01..2de18fd 100644 --- a/res/config.ini +++ b/res/config.ini @@ -44,6 +44,9 @@ bg = 0 # Foreground color id fg = 8 +# CMatrix animation foreground color id +cmatrix_fg = 3 + # Border color border_fg = 8 @@ -164,4 +167,4 @@ xsessions = /usr/share/xsessions # Brightness control brightness_down_key = F5 brightness_up_key = F6 -Brightness_change = 10 \ No newline at end of file +Brightness_change = 10 diff --git a/src/animations/Matrix.zig b/src/animations/Matrix.zig index 5956eb8..9ed242e 100644 --- a/src/animations/Matrix.zig +++ b/src/animations/Matrix.zig @@ -34,8 +34,9 @@ dots: []Dot, lines: []Line, frame: u64, count: u64, +fg_ini: u16, -pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Matrix { +pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer, fg_ini: u16) !Matrix { const dots = try allocator.alloc(Dot, terminal_buffer.width * (terminal_buffer.height + 1)); const lines = try allocator.alloc(Line, terminal_buffer.width); @@ -48,6 +49,7 @@ pub fn init(allocator: Allocator, terminal_buffer: *TerminalBuffer) !Matrix { .lines = lines, .frame = 3, .count = 0, + .fg_ini = fg_ini, }; } @@ -145,7 +147,8 @@ pub fn draw(self: *Matrix) void { var y: u64 = 1; while (y <= self.terminal_buffer.height) : (y += 1) { const dot = self.dots[buf_width * y + x]; - var fg: u16 = @intCast(termbox.TB_GREEN); + + var fg: u16 = self.fg_ini; if (dot.value == -1 or dot.value == ' ') { _ = termbox.tb_set_cell(@intCast(x), @intCast(y - 1), ' ', fg, termbox.TB_DEFAULT); diff --git a/src/config/Config.zig b/src/config/Config.zig index fac60ef..168a6f7 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -16,6 +16,7 @@ clock: ?[:0]const u8 = null, console_dev: [:0]const u8 = "/dev/console", default_input: Input = .login, fg: u8 = 8, +cmatrix_fg: u8 = 3, hide_borders: bool = false, hide_key_hints: bool = false, initial_info_text: ?[]const u8 = null, diff --git a/src/main.zig b/src/main.zig index 69fd4b9..05c06e6 100644 --- a/src/main.zig +++ b/src/main.zig @@ -230,7 +230,7 @@ pub fn main() !void { switch (config.animation) { .none => {}, .doom => doom = try Doom.init(allocator, &buffer), - .matrix => matrix = try Matrix.init(allocator, &buffer), + .matrix => matrix = try Matrix.init(allocator, &buffer, config.cmatrix_fg), } defer { switch (config.animation) {