mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 17:23:01 +01:00
Custom colors proof of concept
Fix formatting Fix repeated variable in example config
This commit is contained in:
parent
2640919318
commit
2ff9d29491
@ -23,6 +23,18 @@ ui = {
|
||||
// true to use native terminal colours, false to use toxic default colour theme
|
||||
native_colors=false;
|
||||
|
||||
// set background color of chat status bars (black, white, red, green, blue, cyan, yellow, magenta)
|
||||
color_bar_bg = "blue";
|
||||
|
||||
// set foreground (text) color of chat status bars (black, white, red, green, blue, cyan, yellow, magenta)
|
||||
color_bar_fg = "white";
|
||||
|
||||
// set foreground accent color of chat status bars (black, white, red, green, blue, cyan, yellow, magenta)
|
||||
color_bar_accent = "cyan";
|
||||
|
||||
// set foreground notify (and typing) color in chat status bar (black, white, red, green, blue, cyan, yellow, magenta)
|
||||
color_bar_notify = "yellow";
|
||||
|
||||
// true to enable autologging, false to disable
|
||||
autolog=false;
|
||||
|
||||
|
60
src/chat.c
60
src/chat.c
@ -1215,63 +1215,63 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
|
||||
switch (status) {
|
||||
case TOX_USER_STATUS_NONE:
|
||||
colour = GREEN_BLUE;
|
||||
colour = STATUS_ONLINE;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_AWAY:
|
||||
colour = YELLOW_BLUE;
|
||||
colour = STATUS_AWAY;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_BUSY:
|
||||
colour = RED_BLUE;
|
||||
colour = STATUS_ONLINE;
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||
wprintw(statusbar->topline, "%s", ONLINE_CHAR);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "] ");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
const bool is_typing = Friends.list[self->num].is_typing;
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
||||
if (is_typing) {
|
||||
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(YELLOW_BLUE));
|
||||
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY));
|
||||
} else {
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
wprintw(statusbar->topline, "%s", statusbar->nick);
|
||||
|
||||
if (is_typing) {
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(YELLOW_BLUE));
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_NOTIFY));
|
||||
} else {
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
} else {
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(statusbar->topline, "%s", OFFLINE_CHAR);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "] ");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(statusbar->topline, "%s", statusbar->nick);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
/* Reset statusbar->statusmsg on window resize */
|
||||
@ -1300,14 +1300,14 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
}
|
||||
|
||||
if (statusbar->statusmsg[0]) {
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " | ");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(statusbar->topline, "%s ", statusbar->statusmsg);
|
||||
} else {
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
int s_y;
|
||||
@ -1315,25 +1315,25 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
getyx(statusbar->topline, s_y, s_x);
|
||||
|
||||
mvwhline(statusbar->topline, s_y, s_x, ' ', x2 - s_x - (KEY_IDENT_DIGITS * 2) - 3);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
wmove(statusbar->topline, 0, x2 - (KEY_IDENT_DIGITS * 2) - 3);
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "{");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
for (size_t i = 0; i < KEY_IDENT_DIGITS; ++i) {
|
||||
wprintw(statusbar->topline, "%02X", Friends.list[self->num].pub_key[i] & 0xff);
|
||||
}
|
||||
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "} ");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
int y;
|
||||
int x;
|
||||
|
40
src/prompt.c
40
src/prompt.c
@ -341,51 +341,51 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
switch (status) {
|
||||
case TOX_USER_STATUS_NONE:
|
||||
status_text = "Online";
|
||||
colour = GREEN_BLUE;
|
||||
colour = STATUS_ONLINE;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_AWAY:
|
||||
status_text = "Away";
|
||||
colour = YELLOW_BLUE;
|
||||
colour = STATUS_AWAY;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_BUSY:
|
||||
status_text = "Busy";
|
||||
colour = RED_BLUE;
|
||||
colour = STATUS_BUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(colour));
|
||||
wprintw(statusbar->topline, "%s", status_text);
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(colour));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "]");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
} else {
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(statusbar->topline, "Offline");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, "]");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||
@ -397,7 +397,7 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
getyx(statusbar->topline, s_y, s_x);
|
||||
|
||||
mvwhline(statusbar->topline, s_y, s_x, ' ', x2 - s_x);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
|
||||
/* Reset statusbar->statusmsg on window resize */
|
||||
if (x2 != self->x) {
|
||||
@ -426,13 +426,13 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
}
|
||||
|
||||
if (statusbar->statusmsg[0]) {
|
||||
wattron(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " | ");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(statusbar->topline, "%s", statusbar->statusmsg);
|
||||
wattroff(statusbar->topline, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
@ -73,6 +73,11 @@ static struct ui_strings {
|
||||
|
||||
const char *mplex_away;
|
||||
const char *mplex_away_note;
|
||||
|
||||
const char *color_bar_bg;
|
||||
const char *color_bar_fg;
|
||||
const char *color_bar_accent;
|
||||
const char *color_bar_notify;
|
||||
} ui_strings = {
|
||||
"ui",
|
||||
"timestamps",
|
||||
@ -100,6 +105,10 @@ static struct ui_strings {
|
||||
"line_normal",
|
||||
"mplex_away",
|
||||
"mplex_away_note",
|
||||
"color_bar_bg",
|
||||
"color_bar_fg",
|
||||
"color_bar_accent",
|
||||
"color_bar_notify",
|
||||
};
|
||||
|
||||
static void ui_defaults(struct user_settings *settings)
|
||||
@ -345,6 +354,22 @@ int settings_load(struct user_settings *s, const char *patharg)
|
||||
snprintf(s->timestamp_format, sizeof(s->timestamp_format), "%s", str);
|
||||
}
|
||||
|
||||
if (config_setting_lookup_string(setting, ui_strings.color_bar_bg, &str)) {
|
||||
snprintf(s->color_bar_bg, sizeof(s->color_bar_bg), "%s", str);
|
||||
}
|
||||
|
||||
if (config_setting_lookup_string(setting, ui_strings.color_bar_fg, &str)) {
|
||||
snprintf(s->color_bar_fg, sizeof(s->color_bar_fg), "%s", str);
|
||||
}
|
||||
|
||||
if (config_setting_lookup_string(setting, ui_strings.color_bar_accent, &str)) {
|
||||
snprintf(s->color_bar_accent, sizeof(s->color_bar_accent), "%s", str);
|
||||
}
|
||||
|
||||
if (config_setting_lookup_string(setting, ui_strings.color_bar_notify, &str)) {
|
||||
snprintf(s->color_bar_notify, sizeof(s->color_bar_notify), "%s", str);
|
||||
}
|
||||
|
||||
if (config_setting_lookup_string(setting, ui_strings.log_timestamp_format, &str)) {
|
||||
snprintf(s->log_timestamp_format, sizeof(s->log_timestamp_format), "%s", str);
|
||||
}
|
||||
|
@ -68,6 +68,11 @@ struct user_settings {
|
||||
char autorun_path[PATH_MAX];
|
||||
char password_eval[PASSWORD_EVAL_MAX];
|
||||
|
||||
char color_bar_bg[COLOR_STR_SIZE];
|
||||
char color_bar_fg[COLOR_STR_SIZE];
|
||||
char color_bar_accent[COLOR_STR_SIZE];
|
||||
char color_bar_notify[COLOR_STR_SIZE];
|
||||
|
||||
int key_next_tab;
|
||||
int key_prev_tab;
|
||||
int key_scroll_line_up;
|
||||
|
115
src/toxic.c
115
src/toxic.c
@ -260,6 +260,10 @@ static void init_term(void)
|
||||
|
||||
if (has_colors()) {
|
||||
short bg_color = COLOR_BLACK;
|
||||
short bar_bg_color = COLOR_BLUE;
|
||||
short bar_fg_color = COLOR_WHITE;
|
||||
short bar_accent_color = COLOR_CYAN;
|
||||
short bar_notify_color = COLOR_YELLOW;
|
||||
start_color();
|
||||
|
||||
if (user_settings->colour_theme == NATIVE_COLS) {
|
||||
@ -268,6 +272,102 @@ static void init_term(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!string_is_empty(user_settings->color_bar_bg)) {
|
||||
if (strcmp(user_settings->color_bar_bg, "black") == 0) {
|
||||
bar_bg_color = COLOR_BLACK;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "red") == 0) {
|
||||
bar_bg_color = COLOR_RED;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "blue") == 0) {
|
||||
bar_bg_color = COLOR_BLUE;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "cyan") == 0) {
|
||||
bar_bg_color = COLOR_CYAN;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "green") == 0) {
|
||||
bar_bg_color = COLOR_GREEN;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "yellow") == 0) {
|
||||
bar_bg_color = COLOR_YELLOW;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "magenta") == 0) {
|
||||
bar_bg_color = COLOR_MAGENTA;
|
||||
} else if (strcmp(user_settings->color_bar_bg, "white") == 0) {
|
||||
bar_bg_color = COLOR_WHITE;
|
||||
} else {
|
||||
bar_bg_color = COLOR_BLUE;
|
||||
}
|
||||
} else {
|
||||
bar_bg_color = COLOR_BLUE;
|
||||
}
|
||||
|
||||
if (!string_is_empty(user_settings->color_bar_fg)) {
|
||||
if (strcmp(user_settings->color_bar_fg, "black") == 0) {
|
||||
bar_fg_color = COLOR_BLACK;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "red") == 0) {
|
||||
bar_fg_color = COLOR_RED;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "blue") == 0) {
|
||||
bar_fg_color = COLOR_BLUE;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "cyan") == 0) {
|
||||
bar_fg_color = COLOR_CYAN;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "green") == 0) {
|
||||
bar_fg_color = COLOR_GREEN;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "yellow") == 0) {
|
||||
bar_fg_color = COLOR_YELLOW;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "magenta") == 0) {
|
||||
bar_fg_color = COLOR_MAGENTA;
|
||||
} else if (strcmp(user_settings->color_bar_fg, "white") == 0) {
|
||||
bar_fg_color = COLOR_WHITE;
|
||||
} else {
|
||||
bar_fg_color = COLOR_WHITE;
|
||||
}
|
||||
} else {
|
||||
bar_fg_color = COLOR_WHITE;
|
||||
}
|
||||
|
||||
if (!string_is_empty(user_settings->color_bar_accent)) {
|
||||
if (strcmp(user_settings->color_bar_accent, "black") == 0) {
|
||||
bar_accent_color = COLOR_BLACK;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "red") == 0) {
|
||||
bar_accent_color = COLOR_RED;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "blue") == 0) {
|
||||
bar_accent_color = COLOR_BLUE;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "cyan") == 0) {
|
||||
bar_accent_color = COLOR_CYAN;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "green") == 0) {
|
||||
bar_accent_color = COLOR_GREEN;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "yellow") == 0) {
|
||||
bar_accent_color = COLOR_YELLOW;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "magenta") == 0) {
|
||||
bar_accent_color = COLOR_MAGENTA;
|
||||
} else if (strcmp(user_settings->color_bar_accent, "white") == 0) {
|
||||
bar_accent_color = COLOR_WHITE;
|
||||
} else {
|
||||
bar_accent_color = COLOR_CYAN;
|
||||
}
|
||||
} else {
|
||||
bar_accent_color = COLOR_CYAN;
|
||||
}
|
||||
|
||||
if (!string_is_empty(user_settings->color_bar_notify)) {
|
||||
if (strcmp(user_settings->color_bar_notify, "black") == 0) {
|
||||
bar_notify_color = COLOR_BLACK;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "red") == 0) {
|
||||
bar_notify_color = COLOR_RED;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "blue") == 0) {
|
||||
bar_notify_color = COLOR_BLUE;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "cyan") == 0) {
|
||||
bar_notify_color = COLOR_CYAN;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "green") == 0) {
|
||||
bar_notify_color = COLOR_GREEN;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "yellow") == 0) {
|
||||
bar_notify_color = COLOR_YELLOW;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "magenta") == 0) {
|
||||
bar_notify_color = COLOR_MAGENTA;
|
||||
} else if (strcmp(user_settings->color_bar_notify, "white") == 0) {
|
||||
bar_notify_color = COLOR_WHITE;
|
||||
} else {
|
||||
bar_notify_color = COLOR_YELLOW;
|
||||
}
|
||||
} else {
|
||||
bar_notify_color = COLOR_YELLOW;
|
||||
}
|
||||
|
||||
init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(GREEN, COLOR_GREEN, bg_color);
|
||||
init_pair(CYAN, COLOR_CYAN, bg_color);
|
||||
@ -278,13 +378,14 @@ static void init_term(void)
|
||||
init_pair(BLACK, COLOR_BLACK, COLOR_BLACK);
|
||||
init_pair(BLUE_BLACK, COLOR_BLUE, COLOR_BLACK);
|
||||
init_pair(BLACK_WHITE, COLOR_BLACK, COLOR_WHITE);
|
||||
init_pair(WHITE_BLUE, COLOR_WHITE, COLOR_BLUE);
|
||||
init_pair(CYAN_BLUE, COLOR_CYAN, COLOR_BLUE);
|
||||
init_pair(GREEN_BLUE, COLOR_GREEN, COLOR_BLUE);
|
||||
init_pair(PURPLE_BLUE, COLOR_MAGENTA, COLOR_BLUE);
|
||||
init_pair(BLACK_BLUE, COLOR_BLACK, COLOR_BLUE);
|
||||
init_pair(YELLOW_BLUE, COLOR_YELLOW, COLOR_BLUE);
|
||||
init_pair(RED_BLUE, COLOR_RED, COLOR_BLUE);
|
||||
init_pair(BLACK_BG, COLOR_BLACK, bar_bg_color);
|
||||
init_pair(PURPLE_BG, COLOR_MAGENTA, bar_bg_color);
|
||||
init_pair(BAR_TEXT, bar_fg_color, bar_bg_color);
|
||||
init_pair(BAR_ACCENT, bar_accent_color, bar_bg_color);
|
||||
init_pair(BAR_NOTIFY, bar_notify_color, bar_bg_color);
|
||||
init_pair(STATUS_ONLINE, COLOR_GREEN, bar_bg_color);
|
||||
init_pair(STATUS_AWAY, COLOR_YELLOW, bar_bg_color);
|
||||
init_pair(STATUS_BUSY, COLOR_RED, bar_bg_color);
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
@ -48,6 +48,7 @@
|
||||
#define TOXIC_MAX_NAME_LENGTH 32 /* Must be <= TOX_MAX_NAME_LENGTH */
|
||||
#define KEY_IDENT_DIGITS 3 /* number of hex digits to display for the pub-key based identifier */
|
||||
#define TIME_STR_SIZE 32
|
||||
#define COLOR_STR_SIZE 10 /* should fit every color option */
|
||||
|
||||
#ifndef MAX_PORT_RANGE
|
||||
#define MAX_PORT_RANGE 65535
|
||||
|
@ -519,21 +519,21 @@ static void draw_window_tab(WINDOW *win, ToxWindow *toxwin, bool active_window)
|
||||
WINDOW_TYPE type = toxwin->type;
|
||||
|
||||
if (active_window) {
|
||||
wattron(win, A_BOLD | COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, A_BOLD | COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, " [");
|
||||
wattroff(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wattron(win, COLOR_PAIR(BAR_TEXT));
|
||||
} else {
|
||||
if (has_alert) {
|
||||
wattron(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, " [");
|
||||
wattroff(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wattron(win, A_BOLD | COLOR_PAIR(toxwin->alert));
|
||||
} else {
|
||||
wattron(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, " [");
|
||||
wattroff(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wattron(win, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,21 +548,21 @@ static void draw_window_tab(WINDOW *win, ToxWindow *toxwin, bool active_window)
|
||||
}
|
||||
|
||||
if (active_window) {
|
||||
wattroff(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_TEXT));
|
||||
wattron(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, "]");
|
||||
wattroff(win, A_BOLD | COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, A_BOLD | COLOR_PAIR(BAR_ACCENT));
|
||||
} else {
|
||||
if (has_alert) {
|
||||
wattroff(win, A_BOLD | COLOR_PAIR(toxwin->alert));
|
||||
wattron(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattron(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_ACCENT));
|
||||
} else {
|
||||
wattroff(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_TEXT));
|
||||
wattron(win, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(win, "]");
|
||||
wattroff(win, COLOR_PAIR(CYAN_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_ACCENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -573,13 +573,13 @@ void draw_window_bar(ToxWindow *self)
|
||||
wclear(win);
|
||||
|
||||
if (self->scroll_pause) {
|
||||
wattron(win, A_BLINK | A_BOLD | COLOR_PAIR(YELLOW_BLUE));
|
||||
wattron(win, A_BLINK | A_BOLD | COLOR_PAIR(BAR_NOTIFY));
|
||||
wprintw(win, "^");
|
||||
wattroff(win, A_BLINK | A_BOLD | COLOR_PAIR(YELLOW_BLUE));
|
||||
wattroff(win, A_BLINK | A_BOLD | COLOR_PAIR(BAR_NOTIFY));
|
||||
} else {
|
||||
wattron(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(win, COLOR_PAIR(BAR_TEXT));
|
||||
wprintw(win, " ");
|
||||
wattroff(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
|
||||
@ -597,9 +597,9 @@ void draw_window_bar(ToxWindow *self)
|
||||
|
||||
getyx(win, cur_y, cur_x);
|
||||
|
||||
wattron(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattron(win, COLOR_PAIR(BAR_TEXT));
|
||||
mvwhline(win, 0, cur_x, ' ', COLS - cur_x);
|
||||
wattroff(win, COLOR_PAIR(WHITE_BLUE));
|
||||
wattroff(win, COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -55,21 +55,22 @@ typedef enum {
|
||||
BLACK,
|
||||
BLUE_BLACK,
|
||||
BLACK_WHITE,
|
||||
WHITE_BLUE,
|
||||
GREEN_BLUE,
|
||||
CYAN_BLUE,
|
||||
PURPLE_BLUE,
|
||||
BLACK_BLUE,
|
||||
RED_BLUE,
|
||||
YELLOW_BLUE,
|
||||
BAR_TEXT,
|
||||
STATUS_ONLINE,
|
||||
BAR_ACCENT,
|
||||
PURPLE_BG,
|
||||
BLACK_BG,
|
||||
STATUS_BUSY,
|
||||
STATUS_AWAY,
|
||||
BAR_NOTIFY,
|
||||
} C_COLOURS;
|
||||
|
||||
/* tab alert types: lower types take priority (this relies on the order of C_COLOURS) */
|
||||
typedef enum {
|
||||
WINDOW_ALERT_NONE = 0,
|
||||
WINDOW_ALERT_0 = GREEN_BLUE,
|
||||
WINDOW_ALERT_1 = CYAN_BLUE,
|
||||
WINDOW_ALERT_2 = PURPLE_BLUE,
|
||||
WINDOW_ALERT_0 = STATUS_ONLINE,
|
||||
WINDOW_ALERT_1 = BAR_ACCENT,
|
||||
WINDOW_ALERT_2 = PURPLE_BG,
|
||||
} WINDOW_ALERTS;
|
||||
|
||||
typedef enum {
|
||||
|
Loading…
Reference in New Issue
Block a user