[01/21] test: Add bash lib for colors

Message ID 20240520090611.10406-2-jonatan.schlag@ipfire.org
State New
Headers
Series [01/21] test: Add bash lib for colors |

Commit Message

Jonatan Schlag May 20, 2024, 9:05 a.m. UTC
  This is borrowed from here: https://git.ipfire.org/?p=network.git;a=blob;f=src/functions/functions.colors;h=0bd6f97177c366f1d1ee4553043ae719430acdb2;hb=refs/heads/master

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 tests/lib_color.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 tests/lib_color.sh
  

Patch

diff --git a/tests/lib_color.sh b/tests/lib_color.sh
new file mode 100644
index 000000000..6ca1c9864
--- /dev/null
+++ b/tests/lib_color.sh
@@ -0,0 +1,43 @@ 
+#!/usr/bin/bash
+
+# Regular colours
+CLR_BLACK_R='\e[0;30m'
+CLR_RED_R='\e[0;31m'
+CLR_GREEN_R='\e[0;32m'
+CLR_YELLOW_R='\e[0;33m'
+CLR_BLUE_R='\e[0;34m'
+CLR_PURPLE_R='\e[0;35m'
+CLR_CYAN_R='\e[0;36m'
+CLR_WHITE_R='\e[0;37m'
+
+# Bold colours
+CLR_BLACK_B='\e[1;30m'
+CLR_RED_B='\e[1;31m'
+CLR_GREEN_B='\e[1;32m'
+CLR_YELLOW_B='\e[1;33m'
+CLR_BLUE_B='\e[1;34m'
+CLR_PURPLE_B='\e[1;35m'
+CLR_CYAN_B='\e[1;36m'
+CLR_WHITE_B='\e[1;37m'
+
+# Background colors
+CLR_BLACK_BG='\e[40m'
+CLR_RED_BG='\e[41m'
+CLR_GREEN_BG='\e[42m'
+CLR_YELLOW_BG='\e[43m'
+CLR_BLUE_BG='\e[44m'
+CLR_PURPLE_BG='\e[45m'
+CLR_CYAN_BG='\e[46m'
+CLR_WHITE_BG='\e[47m'
+
+# Font decoration
+FONT_RESET="\e[0m"
+FONT_BOLD="\e[1m"
+FONT_UNDERLINED="\e[4m"
+FONT_BLINKING="\e[5m"
+FONT_INVERTED="\e[7m"
+
+# Reset everything
+CLR_RESET="${FONT_RESET}"
+
+