|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
#include <ncurses.h> |
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
#define CURSES_MAX_COLOR 1000.0f |
|
|
|
|
|
|
|
|
|
namespace groove { |
|
|
|
|
namespace ncurses { |
|
|
|
@ -8,9 +11,9 @@ namespace groove { |
|
|
|
|
struct Color { |
|
|
|
|
short r, g, b; |
|
|
|
|
Color(short r, short g, short b) : |
|
|
|
|
r(static_cast<short>(r * 0.255)), |
|
|
|
|
g(static_cast<short>(g * 0.255)), |
|
|
|
|
b(static_cast<short>(b * 0.255)) {} |
|
|
|
|
r(static_cast<short>(r / 255.0f * CURSES_MAX_COLOR)), |
|
|
|
|
g(static_cast<short>(g / 255.0f * CURSES_MAX_COLOR)), |
|
|
|
|
b(static_cast<short>(b / 255.0f * CURSES_MAX_COLOR)) {} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
enum Colors { |
|
|
|
@ -21,7 +24,9 @@ namespace groove { |
|
|
|
|
PURPLE, |
|
|
|
|
ORANGE, |
|
|
|
|
CYAN, |
|
|
|
|
GREY |
|
|
|
|
GREY, |
|
|
|
|
LINENUMBERS, |
|
|
|
|
COMMENTS |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class ncurses { |
|
|
|
@ -35,21 +40,35 @@ namespace groove { |
|
|
|
|
keypad(stdscr, true); // Enable special keys to be recorde
|
|
|
|
|
|
|
|
|
|
start_color(); |
|
|
|
|
init_pair(Colors::MAIN, COLOR_WHITE, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::STATUSBAR, COLOR_WHITE, COLOR_MAGENTA); |
|
|
|
|
init_pair(Colors::MAGENTA, COLOR_MAGENTA, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::GREEN, COLOR_GREEN, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::GREY, COLOR_YELLOW, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::CYAN, COLOR_CYAN, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::ORANGE, COLOR_YELLOW, COLOR_BLACK); |
|
|
|
|
|
|
|
|
|
if (can_change_color()) { |
|
|
|
|
Color grey(39, 40, 34); |
|
|
|
|
Color pink(255, 0, 103); |
|
|
|
|
Color cyan(102 , 217, 239); |
|
|
|
|
Color green(162, 217, 43); |
|
|
|
|
Color lightgray(60, 61, 55); |
|
|
|
|
Color lighterGray(144, 144, 138); |
|
|
|
|
Color yellow(230, 219, 116); |
|
|
|
|
|
|
|
|
|
init_color(COLOR_BLACK, grey.r, grey.g, grey.b); |
|
|
|
|
init_color(COLOR_MAGENTA, pink.r, pink.g, pink.b); |
|
|
|
|
init_color(COLOR_CYAN, cyan.r, cyan.g, cyan.b); |
|
|
|
|
init_color(COLOR_BLUE, lightgray.r, lightgray.g, lightgray.b); |
|
|
|
|
init_color(COLOR_YELLOW, yellow.r, yellow.g, yellow.b); |
|
|
|
|
init_color(COLOR_GREEN, green.r, green.g, green.b); |
|
|
|
|
init_color(COLOR_RED, lighterGray.r, lighterGray.g, lighterGray.b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
init_pair(Colors::LINENUMBERS, COLOR_WHITE, COLOR_BLUE); |
|
|
|
|
init_pair(Colors::COMMENTS, COLOR_RED, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::MAIN, COLOR_WHITE, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::STATUSBAR, COLOR_WHITE, COLOR_MAGENTA); |
|
|
|
|
init_pair(Colors::MAGENTA, COLOR_MAGENTA, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::GREEN, COLOR_GREEN, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::GREY, COLOR_YELLOW, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::CYAN, COLOR_CYAN, COLOR_BLACK); |
|
|
|
|
init_pair(Colors::ORANGE, COLOR_YELLOW, COLOR_BLACK); |
|
|
|
|
|
|
|
|
|
attron(COLOR_PAIR(1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|