summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-09-29 23:19:43 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2023-09-29 23:19:43 +0200
commit85f520041046be2a184af31bff8a1d7ca0027f2a (patch)
tree4a8da581ed596e7ebf5e9444029377a8a0299104 /lib
parentbea6db6fc5536293875309ec8fbb6776ecbb59d5 (diff)
downloadcolonial-twilight-85f520041046be2a184af31bff8a1d7ca0027f2a.zip
colonial-twilight-85f520041046be2a184af31bff8a1d7ca0027f2a.tar.gz
ColorizedString : add CLEAR_LINE
Diffstat (limited to 'lib')
-rw-r--r--lib/colonial_twilight/colorized_string.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/colonial_twilight/colorized_string.rb b/lib/colonial_twilight/colorized_string.rb
index db13bbd..2a63852 100644
--- a/lib/colonial_twilight/colorized_string.rb
+++ b/lib/colonial_twilight/colorized_string.rb
@@ -3,7 +3,10 @@
# this adds ascii colorization to String class
class String
+ RESET = "\033[0m"
+ CLEAR_LINE = "\33[2K\r"
CLS = "\033[0;0f\033\[2J"
+
@color_codes = {
black: 0, light_black: 60,
red: 1, light_red: 61,
@@ -58,7 +61,6 @@ class String
private
- RESET = "\033[0m"
START_CODE = /^\033\[([0-9;]+)m/.freeze
# negative lookbehind : (?<! ) + ^ => is not at the start of the line
# negative lookahead : (?! ) + $ => is not at the end of the line