color_echo 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/color_echo.rb +2 -1
- data/lib/color_echo/background.module.rb +8 -8
- data/lib/color_echo/foreground.module.rb +8 -8
- data/lib/color_echo/module_functions.rb +13 -9
- data/lib/color_echo/textattr.module.rb +5 -6
- data/lib/color_echo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bb34e234d1acce0b26eda0cfac75c2bc98f7b7f
|
4
|
+
data.tar.gz: 81bfc6f30d698dbd09bb4e7fed2a141e0e499468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc1963db6bdf205aae374a8e7cc7c4dc62de956e5f2af09db53e9d6391356a5378ae2947c22c330bf2b5a8b63e0bd054c909f55e5b3665b1f499ba0f387e31cd
|
7
|
+
data.tar.gz: 9a42346beef4d45057fbe4f927096d5d2fafc2c3d8ecf3eef41e9b802cfc5f632630a815324a4cf81c2e9eec2ca6fcd516f12a22d8cd9c0157dddcf66ac54248
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ To add color to the command line output.
|
|
3
3
|
This Library will extend the Kernel module's functions(#print, #puts, #p).
|
4
4
|
required StringIO.
|
5
5
|
|
6
|
-
Version: 0.2.
|
6
|
+
Version: 0.2.2
|
7
7
|
Compliant Rubys Version: 1.9.3, 2.0.0, 2.1.0 (for Linux)
|
8
8
|
License: MIT
|
9
9
|
Gems repository: http://rubygems.org/gems/color_echo
|
@@ -137,6 +137,14 @@ CE.rainbow
|
|
137
137
|
puts "String will be rainbow! You can specify the argument only one."
|
138
138
|
puts ["rainbow", "is", "String", "only"]
|
139
139
|
puts "this is rainbow.", "This argument is ignored when rainbow mode."
|
140
|
+
|
141
|
+
CE.rainbow
|
142
|
+
puts <<EOS
|
143
|
+
aaaaaaaaaaaaaaaaaaa
|
144
|
+
aaaaaaaaaaaaaaaaaaa
|
145
|
+
aaaaaaaaaaaaaaaaaaa
|
146
|
+
EOS
|
147
|
+
|
140
148
|
CE.off
|
141
149
|
puts "Disable rainbow mode."
|
142
150
|
</pre>
|
data/lib/color_echo.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
# To add color to the command line output.
|
4
4
|
# This Library will extend the Kernel module's functions(#print, #puts, #p).
|
5
5
|
# @autor: Kazuya Hotta (nyanko)
|
6
|
+
|
6
7
|
begin
|
7
8
|
require "stringio"
|
8
9
|
rescue LoadError
|
9
|
-
warn "color_echo required 'stringio.
|
10
|
+
warn "color_echo required 'stringio'."
|
10
11
|
end
|
11
12
|
|
12
13
|
require_relative "color_echo/version.rb"
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module CE
|
2
2
|
module BackGround
|
3
|
-
BLACK =
|
4
|
-
RED =
|
5
|
-
GREEN =
|
6
|
-
YELLOW =
|
7
|
-
BLUE =
|
8
|
-
MAGENTA =
|
9
|
-
CYAN =
|
10
|
-
WHITE =
|
3
|
+
BLACK = "\e[40m"
|
4
|
+
RED = "\e[41m"
|
5
|
+
GREEN = "\e[42m"
|
6
|
+
YELLOW = "\e[43m"
|
7
|
+
BLUE = "\e[44m"
|
8
|
+
MAGENTA = "\e[45m"
|
9
|
+
CYAN = "\e[46m"
|
10
|
+
WHITE = "\e[47m"
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module CE
|
2
2
|
module ForeGround
|
3
|
-
BLACK =
|
4
|
-
RED =
|
5
|
-
GREEN =
|
6
|
-
YELLOW =
|
7
|
-
BLUE =
|
8
|
-
MAGENTA =
|
9
|
-
CYAN =
|
10
|
-
WHITE =
|
3
|
+
BLACK = "\e[30m"
|
4
|
+
RED = "\e[31m"
|
5
|
+
GREEN = "\e[32m"
|
6
|
+
YELLOW = "\e[33m"
|
7
|
+
BLUE = "\e[34m"
|
8
|
+
MAGENTA = "\e[35m"
|
9
|
+
CYAN = "\e[36m"
|
10
|
+
WHITE = "\e[37m"
|
11
11
|
end
|
12
12
|
end
|
@@ -74,27 +74,31 @@ module CE
|
|
74
74
|
cnt = 0
|
75
75
|
output = ""
|
76
76
|
text.each_char do |char|
|
77
|
-
|
77
|
+
if char == $/
|
78
|
+
output += $/
|
79
|
+
next
|
80
|
+
end
|
78
81
|
|
79
82
|
case cnt
|
80
83
|
when 0
|
81
|
-
output +=
|
84
|
+
output += ForeGround::RED + char + CODE_RESET
|
82
85
|
when 1
|
83
|
-
output +=
|
86
|
+
output += ForeGround::GREEN + char + CODE_RESET
|
84
87
|
when 2
|
85
|
-
output +=
|
88
|
+
output += ForeGround::YELLOW + char + CODE_RESET
|
86
89
|
when 3
|
87
|
-
output +=
|
90
|
+
output += ForeGround::BLUE + char + CODE_RESET
|
88
91
|
when 4
|
89
|
-
output +=
|
92
|
+
output += ForeGround::MAGENTA + char + CODE_RESET
|
90
93
|
when 5
|
91
|
-
output +=
|
94
|
+
output += ForeGround::CYAN + char + CODE_RESET
|
92
95
|
when 6
|
93
|
-
output +=
|
96
|
+
output += ForeGround::WHITE + char + CODE_RESET
|
94
97
|
end
|
95
98
|
cnt += 1
|
96
99
|
cnt = 0 if cnt >= 7
|
97
100
|
end
|
101
|
+
|
98
102
|
return output
|
99
103
|
end
|
100
104
|
|
@@ -104,7 +108,7 @@ module CE
|
|
104
108
|
rescue NameError
|
105
109
|
raise(NameError ,%{:#{name} is not defined! Please check reference.})
|
106
110
|
end
|
107
|
-
return
|
111
|
+
return code
|
108
112
|
end
|
109
113
|
|
110
114
|
def task
|
data/lib/color_echo/version.rb
CHANGED