summaryrefslogtreecommitdiff
path: root/src/basic/terminal-util.h
diff options
context:
space:
mode:
authorAlexander F Rødseth <alexander.rodseth@appeartv.com>2018-03-01 18:23:05 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-03-02 08:58:02 +0100
commit6d1d8f66e03a141b985f456f33b36bf01cebb2d6 (patch)
tree2c27404c47acbfac97eb5d8f3dd0a329cfa1b9f8 /src/basic/terminal-util.h
parent16a4f265e456fc159ce147266224163d12516d3c (diff)
downloadsystemd-6d1d8f66e03a141b985f456f33b36bf01cebb2d6.tar.gz
systemd-6d1d8f66e03a141b985f456f33b36bf01cebb2d6.tar.bz2
systemd-6d1d8f66e03a141b985f456f33b36bf01cebb2d6.zip
Organize the ANSI codes and add missing colors
For consistency.
Diffstat (limited to 'src/basic/terminal-util.h')
-rw-r--r--src/basic/terminal-util.h44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h
index f6e6020b66..8e6f668c25 100644
--- a/src/basic/terminal-util.h
+++ b/src/basic/terminal-util.h
@@ -28,21 +28,45 @@
#include "macro.h"
#include "time-util.h"
-#define ANSI_RED "\x1B[0;31m"
-#define ANSI_GREEN "\x1B[0;32m"
+/* Regular colors */
+#define ANSI_BLACK "\x1B[0;30m"
+#define ANSI_RED "\x1B[0;31m"
+#define ANSI_GREEN "\x1B[0;32m"
+#define ANSI_YELLOW "\x1B[0;33m"
+#define ANSI_BLUE "\x1B[0;34m"
+#define ANSI_MAGENTA "\x1B[0;35m"
+#define ANSI_CYAN "\x1B[0;36m"
+#define ANSI_WHITE "\x1B[0;37m"
+
+/* Bold/highlighted */
+#define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m"
+#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
+#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
+#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
+#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
+#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m"
+#define ANSI_HIGHLIGHT_CYAN "\x1B[0;1;36m"
+#define ANSI_HIGHLIGHT_WHITE "\x1B[0;1;37m"
+
+/* Underlined */
+#define ANSI_HIGHLIGHT_BLACK_UNDERLINE "\x1B[0;1;4;30m"
+#define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m"
+#define ANSI_HIGHLIGHT_GREEN_UNDERLINE "\x1B[0;1;4;32m"
+#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE "\x1B[0;1;4;33m"
+#define ANSI_HIGHLIGHT_BLUE_UNDERLINE "\x1B[0;1;4;34m"
+#define ANSI_HIGHLIGHT_MAGENTA_UNDERLINE "\x1B[0;1;4;35m"
+#define ANSI_HIGHLIGHT_CYAN_UNDERLINE "\x1B[0;1;4;36m"
+#define ANSI_HIGHLIGHT_WHITE_UNDERLINE "\x1B[0;1;4;37m"
+
+/* Other ANSI codes */
#define ANSI_UNDERLINE "\x1B[0;4m"
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
-#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
-#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
-#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
-#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
-#define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m"
-#define ANSI_HIGHLIGHT_GREEN_UNDERLINE "\x1B[0;1;4;32m"
-#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE "\x1B[0;1;4;33m"
-#define ANSI_HIGHLIGHT_BLUE_UNDERLINE "\x1B[0;1;4;34m"
+
+/* Reset/clear ANSI styles */
#define ANSI_NORMAL "\x1B[0m"
+/* Erase characters until the end of the line */
#define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
/* Set cursor to top left corner and clear screen */