diff options
-rw-r--r-- | include/color-names.h | 4 | ||||
-rw-r--r-- | lib/color-names.c | 5 | ||||
-rw-r--r-- | lib/terminal-colors.d.5 | 6 |
3 files changed, 13 insertions, 2 deletions
diff --git a/include/color-names.h b/include/color-names.h index f04bc2ee2..f21a0ee1b 100644 --- a/include/color-names.h +++ b/include/color-names.h @@ -35,6 +35,10 @@ #define UL_COLOR_WHITE "\033[1;37m" + +/* maximal lenght of human readable name of ESC seq. */ +#define UL_COLORNAME_MAXSZ 32 + extern const char *color_sequence_from_colorname(const char *str); #endif /* UTIL_LINUX_COLOR_NAMES_H */ diff --git a/lib/color-names.c b/lib/color-names.c index 923b2f039..6a302d56a 100644 --- a/lib/color-names.c +++ b/lib/color-names.c @@ -24,12 +24,15 @@ const char *color_sequence_from_colorname(const char *str) { static const struct ul_color_name basic_schemes[] = { { "black", UL_COLOR_BLACK }, + { "blink", UL_COLOR_BLINK }, { "blue", UL_COLOR_BLUE }, + { "bold", UL_COLOR_BOLD }, { "brown", UL_COLOR_BROWN }, { "cyan", UL_COLOR_CYAN }, { "darkgray", UL_COLOR_DARK_GRAY }, { "gray", UL_COLOR_GRAY }, { "green", UL_COLOR_GREEN }, + { "halfbright", UL_COLOR_HALFBRIGHT }, { "lightblue", UL_COLOR_BOLD_BLUE }, { "lightcyan", UL_COLOR_BOLD_CYAN }, { "lightgray,", UL_COLOR_GRAY }, @@ -38,6 +41,8 @@ const char *color_sequence_from_colorname(const char *str) { "lightred", UL_COLOR_BOLD_RED }, { "magenta", UL_COLOR_MAGENTA }, { "red", UL_COLOR_RED }, + { "reset", UL_COLOR_RESET, }, + { "reverse", UL_COLOR_REVERSE }, { "yellow", UL_COLOR_BOLD_YELLOW }, }; struct ul_color_name key = { .name = (char *) str }, *res; diff --git a/lib/terminal-colors.d.5 b/lib/terminal-colors.d.5 index 66ecf2c48..f4217a5d8 100644 --- a/lib/terminal-colors.d.5 +++ b/lib/terminal-colors.d.5 @@ -94,8 +94,10 @@ The is a color name, ASCII color sequences or escape sequences. .SS Color names -black, blue, brown, cyan, darkgray, gray, green, lightblue, lightcyan -lightgray, lightgreen, lightmagenta, lightred, magenta, red and yellow +black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright, +lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, magenta, +red, reset, reverse, and yellow. + .SS ANSI color sequences The color sequences are composed of sequences of numbers separated by semicolons. The most common codes are: |