Added configurable cmatrix fg and bg color

This commit is contained in:
b1ten 2024-05-01 10:59:30 -04:00
parent 4ee2b3ecc7
commit dc5f37c849
4 changed files with 22 additions and 2 deletions

View File

@ -6,6 +6,20 @@
# 1 -> CMatrix
#animation = 0
#Cmatrix animation color
#The `animation_cmatrix_fg` and `animation_cmatrix_bg` color settings take a digit 0-8 corresponding to:
#define TB_DEFAULT 0x00
#define TB_BLACK 0x01
#define TB_RED 0x02
#define TB_GREEN 0x03
#define TB_YELLOW 0x04
#define TB_BLUE 0x05
#define TB_MAGENTA 0x06
#define TB_CYAN 0x07
#define TB_WHITE 0x08
#animation_cmatrix_fg = 3
#animation_cmatrix_bg = 0
# format string for clock in top right corner (see strftime specification)
#clock = %c

View File

@ -159,6 +159,8 @@ void config_load(const char *cfg_path)
{
{"animate", &config.animate, config_handle_bool},
{"animation", &config.animation, config_handle_u8},
{"animation_cmatrix_bg",&config.animation_cmatrix_bg, config_handle_u8},
{"animation_cmatrix_fg",&config.animation_cmatrix_fg, config_handle_u8},
{"asterisk", &config.asterisk, config_handle_char},
{"bg", &config.bg, config_handle_u8},
{"bigclock", &config.bigclock, config_handle_bool},
@ -271,6 +273,8 @@ void config_defaults()
{
config.animate = false;
config.animation = 0;
config.animation_cmatrix_bg = 0;
config.animation_cmatrix_fg = 3;
config.asterisk = '*';
config.bg = 0;
config.bigclock = false;

View File

@ -63,6 +63,8 @@ struct config
{
bool animate;
uint8_t animation;
uint8_t animation_cmatrix_bg;
uint8_t animation_cmatrix_fg;
char asterisk;
uint8_t bg;
bool bigclock;

View File

@ -922,8 +922,8 @@ static void matrix(struct term_buf* buf)
for (int i = 1; i <= buf->height; ++i)
{
uint32_t c;
int fg = TB_GREEN;
int bg = TB_DEFAULT;
int fg = config.animation_cmatrix_fg;
int bg = config.animation_cmatrix_bg;
if (s->grid[i][j].val == -1 || s->grid[i][j].val == ' ')
{