From 2b44e93f793cd367728eeb8acab7787df5a82ee6 Mon Sep 17 00:00:00 2001 From: Net Date: Sun, 22 Oct 2017 14:30:49 -0400 Subject: [PATCH 1/3] Support bright named colors --- README.asciidoc | 1 + src/color.cc | 8 ++++++++ src/color.hh | 8 ++++++++ src/ncurses_ui.cc | 8 ++++++++ 4 files changed, 25 insertions(+) diff --git a/README.asciidoc b/README.asciidoc index 7e08b364..76cfabc7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1046,6 +1046,7 @@ fg_color[,bg_color][+attributes] fg_color and bg_color can be: * A named color: `black, red, green, yellow, blue, magenta, cyan, white`. + * A named bright color: `brblack, brred, brgreen, bryellow, brblue, brmagenta, brcyan, brwhite`. * `default`, which keeps the existing color * An rgb color: `rgb:RRGGBB`, with RRGGBB the hexadecimal value of the color. diff --git a/src/color.cc b/src/color.cc index d2335191..f2ad2905 100644 --- a/src/color.cc +++ b/src/color.cc @@ -19,6 +19,14 @@ static constexpr const char* color_names[] = { "magenta", "cyan", "white", + "brblack", + "brred", + "brgreen", + "bryellow", + "brblue", + "brmagenta", + "brcyan", + "brwhite", }; bool is_color_name(StringView color) diff --git a/src/color.hh b/src/color.hh index e4ef24cb..38250f24 100644 --- a/src/color.hh +++ b/src/color.hh @@ -22,6 +22,14 @@ struct Color Magenta, Cyan, White, + BrBlack, + BrRed, + BrGreen, + BrYellow, + BrBlue, + BrMagenta, + BrCyan, + BrWhite, RGB, }; diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 9fed7b00..e151cbb7 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -238,6 +238,14 @@ default_colors = { { Color::Magenta, COLOR_MAGENTA }, { Color::Cyan, COLOR_CYAN }, { Color::White, COLOR_WHITE }, + { Color::BrBlack, 8 }, + { Color::BrRed, 9 }, + { Color::BrGreen, 10 }, + { Color::BrYellow, 11 }, + { Color::BrBlue, 12 }, + { Color::BrMagenta, 13 }, + { Color::BrCyan, 14 }, + { Color::BrWhite, 15 }, }; NCursesUI::NCursesUI() From 74202fab45525513c59130361cc3b5e4a95c620d Mon Sep 17 00:00:00 2001 From: Net Date: Tue, 24 Oct 2017 23:08:22 -0400 Subject: [PATCH 3/3] Rename br* colors to bright-* --- README.asciidoc | 2 +- src/color.cc | 16 ++++++++-------- src/color.hh | 16 ++++++++-------- src/ncurses_ui.cc | 34 +++++++++++++++++----------------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 76cfabc7..0430042a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1046,7 +1046,7 @@ fg_color[,bg_color][+attributes] fg_color and bg_color can be: * A named color: `black, red, green, yellow, blue, magenta, cyan, white`. - * A named bright color: `brblack, brred, brgreen, bryellow, brblue, brmagenta, brcyan, brwhite`. + * A named bright color: `bright-black, bright-red, bright-green, bright-yellow, bright-blue, bright-magenta, bright-cyan, bright-white`. * `default`, which keeps the existing color * An rgb color: `rgb:RRGGBB`, with RRGGBB the hexadecimal value of the color. diff --git a/src/color.cc b/src/color.cc index f2ad2905..aef26bfa 100644 --- a/src/color.cc +++ b/src/color.cc @@ -19,14 +19,14 @@ static constexpr const char* color_names[] = { "magenta", "cyan", "white", - "brblack", - "brred", - "brgreen", - "bryellow", - "brblue", - "brmagenta", - "brcyan", - "brwhite", + "bright-black", + "bright-red", + "bright-green", + "bright-yellow", + "bright-blue", + "bright-magenta", + "bright-cyan", + "bright-white", }; bool is_color_name(StringView color) diff --git a/src/color.hh b/src/color.hh index 38250f24..ae8046ab 100644 --- a/src/color.hh +++ b/src/color.hh @@ -22,14 +22,14 @@ struct Color Magenta, Cyan, White, - BrBlack, - BrRed, - BrGreen, - BrYellow, - BrBlue, - BrMagenta, - BrCyan, - BrWhite, + BrightBlack, + BrightRed, + BrightGreen, + BrightYellow, + BrightBlue, + BrightMagenta, + BrightCyan, + BrightWhite, RGB, }; diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index e151cbb7..a1e95bd6 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -229,23 +229,23 @@ void on_term_resize(int) static const std::initializer_list::Item> default_colors = { - { Color::Default, -1 }, - { Color::Black, COLOR_BLACK }, - { Color::Red, COLOR_RED }, - { Color::Green, COLOR_GREEN }, - { Color::Yellow, COLOR_YELLOW }, - { Color::Blue, COLOR_BLUE }, - { Color::Magenta, COLOR_MAGENTA }, - { Color::Cyan, COLOR_CYAN }, - { Color::White, COLOR_WHITE }, - { Color::BrBlack, 8 }, - { Color::BrRed, 9 }, - { Color::BrGreen, 10 }, - { Color::BrYellow, 11 }, - { Color::BrBlue, 12 }, - { Color::BrMagenta, 13 }, - { Color::BrCyan, 14 }, - { Color::BrWhite, 15 }, + { Color::Default, -1 }, + { Color::Black, 0 }, + { Color::Red, 1 }, + { Color::Green, 2 }, + { Color::Yellow, 3 }, + { Color::Blue, 4 }, + { Color::Magenta, 5 }, + { Color::Cyan, 6 }, + { Color::White, 7 }, + { Color::BrightBlack, 8 }, + { Color::BrightRed, 9 }, + { Color::BrightGreen, 10 }, + { Color::BrightYellow, 11 }, + { Color::BrightBlue, 12 }, + { Color::BrightMagenta, 13 }, + { Color::BrightCyan, 14 }, + { Color::BrightWhite, 15 }, }; NCursesUI::NCursesUI()