rbtext 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a729d44ed2a3ab04b78d02b0d0226f3630ed47d789c8534f4f84244eb658395
4
- data.tar.gz: 68e66d49346a58ed12ff5fa7bd7c44c9b6ce5a21f647f08be7b46d72acd06e2e
3
+ metadata.gz: 8c7aca79a52e20d6e7d51024f1029cc8ed92a2e870f796026463005acfa28d37
4
+ data.tar.gz: 8ed901117befbb3899c7a5f1ef9b64c03bec6e0cbe43da498295b6e7e3e4576e
5
5
  SHA512:
6
- metadata.gz: 418da7b0d089e55f49fd9de6695899e4aec6f19c86860410d6fe4cc900c94c74658253eaec9f6fa9f13814060415cceaade928a9feae04467d881a01d4625ed4
7
- data.tar.gz: db96c6606483f074eaf77990d64e18017b1e5e0f5867cd90f470ae07bb28aada188843ea19999000b310ecf569f41e4fce76919d9640b13fbfb4b869b03d7d90
6
+ metadata.gz: 3de37ec9edf252ac34d556b57a52dd5a83fdf8ab43c6099369fc73d30fb43cae5a95084eda353e8789e87064689e204b7dcc9eaed9214744851ffbcf1a988b75
7
+ data.tar.gz: 9255ebee6de279081a194c964096c6c5eaf1e35c3101d1304a2e2cefc0cf5ab4763c87feb8c0385f95703ee916598c4efa6dfb03f750906fc381e37ebbfe0960
data/lib/rbtext/colors.rb CHANGED
@@ -17,7 +17,8 @@ module RBText
17
17
  light_blue: "94",
18
18
  light_magenta: "95",
19
19
  light_cyan: "96",
20
- white: "97"
20
+ white: "97",
21
+ reset: "39"
21
22
  }
22
23
  end
23
24
 
@@ -41,11 +42,15 @@ module RBText
41
42
  return "\033[#{color_code}m"
42
43
  end
43
44
 
44
- module_function :fg_color_codes, :bg_color_codes, :color
45
+ def num_color(num, type: :fg)
46
+ return "\033[#{type == :fg ? "38" : "48"};5;#{num}m"
47
+ end
48
+
49
+ module_function :fg_color_codes, :bg_color_codes, :color, :num_color
45
50
  end
46
51
 
47
52
  module C
48
53
  include RBText::Colors
49
- module_function :fg_color_codes, :bg_color_codes, :color
54
+ module_function :fg_color_codes, :bg_color_codes, :color, :num_color
50
55
  end
51
56
  end
@@ -1,7 +1,13 @@
1
1
  module RBText
2
2
  module Formatting
3
- def reset
4
- "\033[0m"
3
+ def reset(f_opt = nil)
4
+ if f_opt
5
+ "\033[#{
6
+ f_opt =~ /^\033\[(1|2)m$/ ? "\033[22m" : "\033[2#{f_opt.gsub(/[^0-9]/, "")}m"
7
+ }"
8
+ else
9
+ "\033[0m"
10
+ end
5
11
  end
6
12
 
7
13
  def bold
@@ -20,11 +26,19 @@ module RBText
20
26
  "\033[4m"
21
27
  end
22
28
 
23
- module_function :reset, :bold, :faint, :italic, :underline
29
+ def blinking
30
+ "\033[5m"
31
+ end
32
+
33
+ def strikethrough
34
+ "\033[9m"
35
+ end
36
+
37
+ module_function :reset, :bold, :faint, :italic, :underline, :blinking, :strikethrough
24
38
  end
25
39
 
26
40
  module F
27
41
  include RBText::Formatting
28
- module_function :reset, :bold, :faint, :italic, :underline
42
+ module_function :reset, :bold, :faint, :italic, :underline, :blinking, :strikethrough
29
43
  end
30
44
  end
data/lib/rbtext/ftext.rb CHANGED
@@ -15,6 +15,10 @@ module RBText
15
15
  @text << RBText::Colors.color(x[1].to_sym)
16
16
  elsif x[0] == "cb"
17
17
  @text << RBText::Colors.color(x[1].to_sym, type: :bg)
18
+ elsif x[0] == "cfn" || x[0] == "cn"
19
+ @text << RBText::Colors.num_color(x[1])
20
+ elsif x[0] == "cbn"
21
+ @text << RBText::Colors.num_color(x[1], type: :bg)
18
22
  elsif x[0] == "f"
19
23
  if x[1] == "reset"
20
24
  @text << RBText::Formatting.reset
@@ -26,6 +30,24 @@ module RBText
26
30
  @text << RBText::Formatting.italic
27
31
  elsif x[1] == "underline"
28
32
  @text << RBText::Formatting.underline
33
+ elsif x[1] == "strikethrough"
34
+ @text << RBText::Formatting.strikethrough
35
+ elsif x[1] == "blinking"
36
+ @text << RBText::Formatting.blinking
37
+ end
38
+ elsif x[0] == "rf"
39
+ if x[1] == "bold"
40
+ @text << RBText::Formatting.reset(R::F.bold)
41
+ elsif x[1] == "faint"
42
+ @text << RBText::Formatting.reset(R::F.faint)
43
+ elsif x[1] == "italic"
44
+ @text << RBText::Formatting.reset(R::F.italic)
45
+ elsif x[1] == "underline"
46
+ @text << RBText::Formatting.reset(R::F.underline)
47
+ elsif x[1] == "strikethrough"
48
+ @text << RBText::Formatting.reset(R::F.strikethrough)
49
+ elsif x[1] == "blinking"
50
+ @text << RBText::Formatting.reset(R::F.blinking)
29
51
  end
30
52
  end
31
53
  else
data/lib/rbtext.rb CHANGED
@@ -7,10 +7,11 @@ require_relative "rbtext/screen.rb"
7
7
  module RBText
8
8
  @ver_1 = 0
9
9
  @ver_2 = 0
10
- @ver_3 = 6
10
+ @ver_3 = 7
11
+ @ver_4 = ""
11
12
 
12
13
  def version
13
- "#{@ver_1}.#{@ver_2}.#{@ver_3}"
14
+ "#{@ver_1}.#{@ver_2}.#{@ver_3}#{".#{@ver_4}" if @ver_4.length > 1}"
14
15
  end
15
16
 
16
17
  module_function :version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-19 00:00:00.000000000 Z
11
+ date: 2022-03-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem for printing formatted text
14
14
  email: matthias@matthiasclee.com