commits
tags
#include "colors.h"
void colors_init(void) {
if (!has_colors()) return;
start_color();
use_default_colors();
init_pair(PAIR_BORDER, COLOR_BLUE, -1);
init_pair(PAIR_BORDER_FOCUS, COLOR_CYAN, -1);
init_pair(PAIR_TITLE, COLOR_CYAN, -1);
init_pair(PAIR_STATUS_PENDING, COLOR_YELLOW, -1);
init_pair(PAIR_STATUS_DOWNLOADING, COLOR_CYAN, -1);
init_pair(PAIR_STATUS_DONE, COLOR_GREEN, -1);
init_pair(PAIR_STATUS_ERROR, COLOR_RED, -1);
init_pair(PAIR_PROGRESS_FILLED, COLOR_GREEN, -1);
init_pair(PAIR_MSG_ERROR, COLOR_RED, -1);
init_pair(PAIR_MSG_INFO, COLOR_GREEN, -1);
}
void draw_rounded_box(WINDOW *win, int pair) {
int has_pair = pair > 0 && has_colors();
if (has_pair) wattron(win, COLOR_PAIR(pair));
box(win, 0, 0);
int h, w;
getmaxyx(win, h, w);
mvwaddstr(win, 0, 0, "╭"); /* rounded top-left */
mvwaddstr(win, 0, w - 1, "╮"); /* rounded top-right */
mvwaddstr(win, h - 1, 0, "╰"); /* rounded bottom-left */
mvwaddstr(win, h - 1, w - 1, "╯"); /* rounded bottom-right */
if (has_pair) wattroff(win, COLOR_PAIR(pair));
}