color_echo 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 222c2ae72f62a588fc6e1f25a214bda6103e69f8
4
- data.tar.gz: 0170867e3a2ac9f705226f2a3d86656bf1b0fcd1
3
+ metadata.gz: 39af711706bd8e500fc5673edc8df5a5fb03d607
4
+ data.tar.gz: 15a50d0d65ebcedaf5d3ea50e20963278aacbddb
5
5
  SHA512:
6
- metadata.gz: bea7e278f6e1a131970bcb82d647e571610f5d8e33630a76d8f727305af5a63c3408dc1161d3aa32a83a98724e5a02fbb571f7ec3cbba83c6db51fd5e62cbaef
7
- data.tar.gz: 5c64c7aefdf1aa03972a5ee8daeca71afe958ddeb63a64c451c0aa428115583ed1a28a77579e4f46959ab863afc78399b587b7b6a93e817c589f1929013f4d10
6
+ metadata.gz: 2d0c3bb3813a90203a0d99f1dbc4519ea9991ad15310d5496284602bdcb26c62b6c58bd6e08d01688bcaccef7adb66470924f4689c17a2a993d6208185d90ed3
7
+ data.tar.gz: a37cb37999324b77806bf25ef69781f8e8091355231d0534b1fa2ab3ec7edbacbbf63746aea89045782b636f8ef2b9e594d8addd3826d6ad1d613fd1248e91e8
data/README.md CHANGED
@@ -3,7 +3,7 @@ Using the ANSI escape sequence and give it a color on 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.3.0
6
+ Version: 0.4.0
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
@@ -47,6 +47,9 @@ return self.
47
47
  * h_cyan
48
48
  * h_white
49
49
 
50
+ available in version 0.4.0 on and after.
51
+ * index[1-256]
52
+
50
53
  ex.) CE.ch_fg :red #=> foreground color will be changed red
51
54
 
52
55
  #### CE.ch_bg :symbol
@@ -76,6 +79,9 @@ return self.
76
79
  * h_cyan
77
80
  * h_white
78
81
 
82
+ available in version 0.4.0 on and after.
83
+ * index[1-256]
84
+
79
85
  ex.) CE.ch_bg :white #=> background color will be changed white
80
86
 
81
87
 
@@ -126,6 +132,12 @@ Text color will change to rainbow color.
126
132
  -> Can v0.2.4 on and after be able to specify a non-string when rainbow mode.
127
133
  This method is available in version 0.2.0 on and after.
128
134
 
135
+
136
+ ### Can to select 256 colors!
137
+ Please install color_echo and do `ruby test/check_color_index_list.rb`.
138
+ ![screen shot](/images/color_index.png)
139
+
140
+
129
141
  ### Example
130
142
  ```ruby
131
143
  #
@@ -212,6 +224,9 @@ puts "Disable rainbow mode."
212
224
  ![screen shot](/images/screenshot.png)
213
225
 
214
226
  ## Release Note
227
+ * v0.4.0, 2014-12-11
228
+ * Can to select 256 colors.
229
+
215
230
  * v0.3.0, 2014-12-08
216
231
  * High color can now be selected.
217
232
  * Multiple text attribute can now be selected.
@@ -16,5 +16,6 @@ module CE
16
16
  H_MAGENTA = "\033[105m"
17
17
  H_CYAN = "\033[106m"
18
18
  H_WHITE = "\033[107m"
19
+ INDEX = "\033[48;5;"
19
20
  end
20
21
  end
@@ -16,5 +16,6 @@ module CE
16
16
  H_MAGENTA = "\033[95m"
17
17
  H_CYAN = "\033[96m"
18
18
  H_WHITE = "\033[97m"
19
+ INDEX = "\033[38;5;"
19
20
  end
20
21
  end
@@ -158,7 +158,15 @@ module CE
158
158
  # @return String
159
159
  def convert_to_code(module_name, name)
160
160
  begin
161
- code = eval(%{#{module_name}::#{name.to_s.swapcase!}})
161
+ cname = name.to_s.swapcase
162
+
163
+ # specified color index
164
+ if cname.index("INDEX")
165
+ num = cname.sub("INDEX", "").to_i - 1
166
+ return eval(%{#{module_name}::INDEX}) + num.to_s + "m"
167
+ end
168
+
169
+ code = eval(%{#{module_name}::#{cname}})
162
170
  rescue NameError
163
171
  raise(NameError ,%{:#{name} is not defined! Please check reference.})
164
172
  end
@@ -1,3 +1,3 @@
1
1
  module CE
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: color_echo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nyanko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Using the ANSI escape sequence and give it a color on the command line output.