diff options
-rw-r--r-- | ui.c | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/ui.c b/ui.c index 3b0c2d9..01dcbab 100644 --- a/ui.c +++ b/ui.c @@ -68,11 +68,22 @@ void uiInit(void) { start_color(); use_default_colors(); - for (short pair = 0; pair < 077; ++pair) { - if (pair < 010) { - init_pair(1 + pair, pair, -1); - } else { - init_pair(1 + pair, pair & 007, (pair & 070) >> 3); + + if (COLORS >= 16) { + for (short pair = 0; pair < 0xFF; ++pair) { + if (pair < 0x10) { + init_pair(1 + pair, pair, -1); + } else { + init_pair(1 + pair, pair & 0x0F, (pair & 0xF0) >> 4); + } + } + } else { + for (short pair = 0; pair < 077; ++pair) { + if (pair < 010) { + init_pair(1 + pair, pair, -1); + } else { + init_pair(1 + pair, pair & 007, (pair & 070) >> 3); + } } } @@ -128,79 +139,70 @@ void uiDraw(void) { doupdate(); } -static const struct AttrColor { - attr_t attr; - short pair; -} MIRC_COLORS[16] = { - { A_BOLD, COLOR_WHITE }, // white - { A_NORMAL, COLOR_BLACK }, // black - { A_NORMAL, COLOR_BLUE }, // blue - { A_NORMAL, COLOR_GREEN }, // green - { A_BOLD, COLOR_RED }, // red - { A_NORMAL, COLOR_RED }, // "brown" - { A_NORMAL, COLOR_MAGENTA }, // magenta - { A_NORMAL, COLOR_YELLOW }, // "orange" - { A_BOLD, COLOR_YELLOW }, // yellow - { A_BOLD, COLOR_GREEN }, // light green - { A_NORMAL, COLOR_CYAN }, // cyan - { A_BOLD, COLOR_CYAN }, // light cyan - { A_BOLD, COLOR_BLUE }, // light blue - { A_BOLD, COLOR_MAGENTA }, // "pink" - { A_BOLD, COLOR_BLACK }, // grey - { A_NORMAL, COLOR_WHITE }, // light grey +static const short MIRC_COLORS[16] = { + 8 + COLOR_WHITE, // white + 0 + COLOR_BLACK, // black + 0 + COLOR_BLUE, // blue + 0 + COLOR_GREEN, // green + 8 + COLOR_RED, // red + 0 + COLOR_RED, // brown + 0 + COLOR_MAGENTA, // magenta + 0 + COLOR_YELLOW, // orange + 8 + COLOR_YELLOW, // yellow + 8 + COLOR_GREEN, // light green + 0 + COLOR_CYAN, // cyan + 8 + COLOR_CYAN, // light cyan + 8 + COLOR_BLUE, // light blue + 8 + COLOR_MAGENTA, // pink + 8 + COLOR_BLACK, // gray + 0 + COLOR_WHITE, // light gray }; -static const char *parseColor(struct AttrColor *color, const char *str) { +static const char *parseColor(short *pair, const char *str) { short fg = 0; size_t fgLen = MIN(strspn(str, "0123456789"), 2); - if (!fgLen) { - color->attr = A_NORMAL; - color->pair = -1; - return str; - } + if (!fgLen) { *pair = -1; return str; } for (size_t i = 0June McEnroe | 2020-02-02 | ||
* | Add extremely basid handlePrivmsg | June McEnroe | 2020-02-02 |
* | Remove style string macros | June McEnroe | 2020-02-02 |
* | Add idColors | June McEnroe | 2020-02-02 |
* | Implement window switching and status line | June McEnroe | 2020-02-02 |
* | Preserve copyright year in term.c | June McEnroe | 2020-02-02 |
* | Add color hashing function | June McEnroe | 2020-02-02 |
* | Handle nickname errors | June McEnroe | 2020-02-02 |
* | Call reset_shell_mode on err | June McEnroe | 2020-02-02 |
* | Wrap before the very edge of the screen | June McEnroe | 2020-02-02 |
* | Parse time tag | June McEnroe | 2020-02-02 |
* | Implement wordWidth | June McEnroe | 2020-02-02 |
* | Implement word wrap | June McEnroe | 2020-02-01 |
* | Parse IRC styling in UI | June McEnroe | 2020-02-01 |
* | Generate tags file | June McEnroe | 2020-02-01 |
* | Implement the beginnings of UI | June McEnroe | 2020-02-01 |
* | Add term stuff | June McEnroe | 2020-02-01 |
* | Add IDs and names | June McEnroe | 2020-02-01 |
* | Add -v flag | June McEnroe | 2020-02-01 |
* | Fix CapNames array indices | June McEnroe | 2020-02-01 |
* | Blindly implement login flow | June McEnroe | 2020-02-01 |
* | Add more login options to the manual page | June McEnroe | 2020-02-01 |
* | Add simple manual page | June McEnroe | 2020-01-31 |