Add configurable border_fg

Signed-off-by: Jonny Tischbein <jonny_tischbein@systemli.org>
This commit is contained in:
Jonny Tischbein 2023-09-25 09:44:15 +02:00
parent 4ee2b3ecc7
commit 9f0df3ea4a
4 changed files with 13 additions and 7 deletions

View File

@ -43,6 +43,9 @@
# Foreground color id # Foreground color id
#fg = 9 #fg = 9
# Border color id
#border_fg = 9
# Blank main box background # Blank main box background
# Setting to false will make it transparent # Setting to false will make it transparent
#blank_box = true #blank_box = true

View File

@ -168,6 +168,7 @@ void config_load(const char *cfg_path)
{"console_dev", &config.console_dev, config_handle_str}, {"console_dev", &config.console_dev, config_handle_str},
{"default_input", &config.default_input, config_handle_u8}, {"default_input", &config.default_input, config_handle_u8},
{"fg", &config.fg, config_handle_u8}, {"fg", &config.fg, config_handle_u8},
{"border_fg", &config.border_fg, config_handle_u8},
{"hide_borders", &config.hide_borders, config_handle_bool}, {"hide_borders", &config.hide_borders, config_handle_bool},
{"hide_key_hints", &config.hide_key_hints, config_handle_bool}, {"hide_key_hints", &config.hide_key_hints, config_handle_bool},
{"input_len", &config.input_len, config_handle_u8}, {"input_len", &config.input_len, config_handle_u8},
@ -280,6 +281,7 @@ void config_defaults()
config.console_dev = strdup("/dev/console"); config.console_dev = strdup("/dev/console");
config.default_input = LOGIN_INPUT; config.default_input = LOGIN_INPUT;
config.fg = 9; config.fg = 9;
config.border_fg = 9;
config.hide_borders = false; config.hide_borders = false;
config.hide_key_hints = false; config.hide_key_hints = false;
config.input_len = 34; config.input_len = 34;

View File

@ -72,6 +72,7 @@ struct config
char* console_dev; char* console_dev;
uint8_t default_input; uint8_t default_input;
uint8_t fg; uint8_t fg;
uint8_t border_fg;
bool hide_borders; bool hide_borders;
bool hide_key_hints; bool hide_key_hints;
uint8_t input_len; uint8_t input_len;

View File

@ -107,30 +107,30 @@ void draw_box(struct term_buf* buf)
box_x - 1, box_x - 1,
box_y - 1, box_y - 1,
buf->box_chars.left_up, buf->box_chars.left_up,
config.fg, config.border_fg,
config.bg); config.bg);
tb_change_cell( tb_change_cell(
box_x2, box_x2,
box_y - 1, box_y - 1,
buf->box_chars.right_up, buf->box_chars.right_up,
config.fg, config.border_fg,
config.bg); config.bg);
tb_change_cell( tb_change_cell(
box_x - 1, box_x - 1,
box_y2, box_y2,
buf->box_chars.left_down, buf->box_chars.left_down,
config.fg, config.border_fg,
config.bg); config.bg);
tb_change_cell( tb_change_cell(
box_x2, box_x2,
box_y2, box_y2,
buf->box_chars.right_down, buf->box_chars.right_down,
config.fg, config.border_fg,
config.bg); config.bg);
// top and bottom // top and bottom
struct tb_cell c1 = {buf->box_chars.top, config.fg, config.bg}; struct tb_cell c1 = {buf->box_chars.top, config.border_fg, config.bg};
struct tb_cell c2 = {buf->box_chars.bot, config.fg, config.bg}; struct tb_cell c2 = {buf->box_chars.bot, config.border_fg, config.bg};
for (uint16_t i = 0; i < buf->box_width; ++i) for (uint16_t i = 0; i < buf->box_width; ++i)
{ {
@ -164,7 +164,7 @@ void draw_box(struct term_buf* buf)
if (config.blank_box) if (config.blank_box)
{ {
struct tb_cell blank = {' ', config.fg, config.bg}; struct tb_cell blank = {' ', config.border_fg, config.bg};
for (uint16_t i = 0; i < buf->box_height; ++i) for (uint16_t i = 0; i < buf->box_height; ++i)
{ {