mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-12 13:59:46 -04:00
feat(terminal): add BLACK
color support
This commit is contained in:
parent
baa01a88e2
commit
b57c3808e7
@ -36,6 +36,7 @@ namespace dwarfs {
|
|||||||
|
|
||||||
enum class termcolor {
|
enum class termcolor {
|
||||||
NORMAL,
|
NORMAL,
|
||||||
|
BLACK,
|
||||||
RED,
|
RED,
|
||||||
GREEN,
|
GREEN,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
@ -44,6 +45,7 @@ enum class termcolor {
|
|||||||
CYAN,
|
CYAN,
|
||||||
WHITE,
|
WHITE,
|
||||||
GRAY,
|
GRAY,
|
||||||
|
BOLD_BLACK,
|
||||||
BOLD_RED,
|
BOLD_RED,
|
||||||
BOLD_GREEN,
|
BOLD_GREEN,
|
||||||
BOLD_YELLOW,
|
BOLD_YELLOW,
|
||||||
@ -52,6 +54,7 @@ enum class termcolor {
|
|||||||
BOLD_CYAN,
|
BOLD_CYAN,
|
||||||
BOLD_WHITE,
|
BOLD_WHITE,
|
||||||
BOLD_GRAY,
|
BOLD_GRAY,
|
||||||
|
DIM_BLACK,
|
||||||
DIM_RED,
|
DIM_RED,
|
||||||
DIM_GREEN,
|
DIM_GREEN,
|
||||||
DIM_YELLOW,
|
DIM_YELLOW,
|
||||||
@ -74,6 +77,7 @@ class terminal {
|
|||||||
virtual bool is_fancy() const = 0;
|
virtual bool is_fancy() const = 0;
|
||||||
virtual std::string_view
|
virtual std::string_view
|
||||||
color(termcolor color, termstyle style = termstyle::NORMAL) const = 0;
|
color(termcolor color, termstyle style = termstyle::NORMAL) const = 0;
|
||||||
|
virtual std::string_view bgcolor(termcolor color) const = 0;
|
||||||
virtual std::string
|
virtual std::string
|
||||||
colored(std::string text, termcolor color, bool enable = true,
|
colored(std::string text, termcolor color, bool enable = true,
|
||||||
termstyle style = termstyle::NORMAL) const = 0;
|
termstyle style = termstyle::NORMAL) const = 0;
|
||||||
|
@ -140,6 +140,7 @@ std::string_view terminal_ansi::color_impl(termcolor color, termstyle style) {
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
colors = {{
|
colors = {{
|
||||||
"\033[0m",
|
"\033[0m",
|
||||||
|
"\033[30m",
|
||||||
"\033[31m",
|
"\033[31m",
|
||||||
"\033[32m",
|
"\033[32m",
|
||||||
"\033[33m",
|
"\033[33m",
|
||||||
@ -148,6 +149,7 @@ std::string_view terminal_ansi::color_impl(termcolor color, termstyle style) {
|
|||||||
"\033[36m",
|
"\033[36m",
|
||||||
"\033[37m",
|
"\033[37m",
|
||||||
"\033[90m",
|
"\033[90m",
|
||||||
|
"\033[1;30m",
|
||||||
"\033[1;31m",
|
"\033[1;31m",
|
||||||
"\033[1;32m",
|
"\033[1;32m",
|
||||||
"\033[1;33m",
|
"\033[1;33m",
|
||||||
@ -156,6 +158,7 @@ std::string_view terminal_ansi::color_impl(termcolor color, termstyle style) {
|
|||||||
"\033[1;36m",
|
"\033[1;36m",
|
||||||
"\033[1;37m",
|
"\033[1;37m",
|
||||||
"\033[1;90m",
|
"\033[1;90m",
|
||||||
|
"\033[2;30m",
|
||||||
"\033[2;31m",
|
"\033[2;31m",
|
||||||
"\033[2;32m",
|
"\033[2;32m",
|
||||||
"\033[2;33m",
|
"\033[2;33m",
|
||||||
|
@ -233,6 +233,7 @@ std::string_view test_terminal::color(termcolor color, termstyle style) const {
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
colors = {{
|
colors = {{
|
||||||
"<normal>",
|
"<normal>",
|
||||||
|
"<black>",
|
||||||
"<red>",
|
"<red>",
|
||||||
"<green>",
|
"<green>",
|
||||||
"<yellow>",
|
"<yellow>",
|
||||||
@ -241,6 +242,7 @@ std::string_view test_terminal::color(termcolor color, termstyle style) const {
|
|||||||
"<cyan>",
|
"<cyan>",
|
||||||
"<white>",
|
"<white>",
|
||||||
"<gray>",
|
"<gray>",
|
||||||
|
"<bold-black>",
|
||||||
"<bold-red>",
|
"<bold-red>",
|
||||||
"<bold-green>",
|
"<bold-green>",
|
||||||
"<bold-yellow>",
|
"<bold-yellow>",
|
||||||
@ -249,6 +251,7 @@ std::string_view test_terminal::color(termcolor color, termstyle style) const {
|
|||||||
"<bold-cyan>",
|
"<bold-cyan>",
|
||||||
"<bold-white>",
|
"<bold-white>",
|
||||||
"<bold-gray>",
|
"<bold-gray>",
|
||||||
|
"<dim-black>",
|
||||||
"<dim-red>",
|
"<dim-red>",
|
||||||
"<dim-green>",
|
"<dim-green>",
|
||||||
"<dim-yellow>",
|
"<dim-yellow>",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user