From a234ea59b3d8960576a37f26c6ad8258374063f0 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sun, 10 Dec 2023 19:22:58 +0100 Subject: [PATCH] added Ansi class --- src/util/Ansi.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/util/Ansi.scala diff --git a/src/util/Ansi.scala b/src/util/Ansi.scala new file mode 100644 index 0000000..259810d --- /dev/null +++ b/src/util/Ansi.scala @@ -0,0 +1,19 @@ +package util + +object Ansi { + val ESC: String = "\u001b[" + val CLEAR: String = code("0") + val BOLD: String = code("1") + val FAINT: String = code("2") + val ITALIC: String = code("3") + val UNDERLINE: String = code("4") + val SLOW_BLINK: String = code("5") + val RAPID_BLINK: String = code("6") + val REVERSE: String = code("7") + val CONCEAL: String = code("8") + val STRIKETHROUGH: String = code("9") + def FG_RGB(r: Int, g: Int, b: Int): String = code(s"38;2;$r;$g;${b}") + def BG_RGB(r: Int, g: Int, b: Int): String = code(s"48;2;$r;$g;${b}") + + private def code(str: String): String = ESC+str+"m" +} \ No newline at end of file