term-ansicolor 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGES +2 -2
- data/VERSION +1 -1
- data/lib/term/ansicolor.rb +1 -6
- data/lib/term/ansicolor/version.rb +1 -1
- data/term-ansicolor.gemspec +1 -1
- data/tests/ansicolor_test.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmJjN2JlMmUwMTMwOGYzYzZjNTU2NGMyZDc2N2UyMDdmYmFlNTRjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGExZTJkNWY3NWQ5OGI0YmYyYjQ2ZGRiMDQyZGQ2OGJlYjUzNmY2Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGRjODI4NWNiMzAwY2MzODBlMzUzZTNiNWM0OTAxYzI5NmUyMmMxOGJlZTZi
|
10
|
+
ZDJkYTQ0ZTlhMjJlMzhlZTBkZTZjNmIyMDI5MzljOGJmZTUxZTk2N2QyN2Fi
|
11
|
+
OGExNjJkOTg5NzhmZTZmZjIxMWZkZmViMTc1NmU3ODI2MTgxZjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjhlZGUwNTExNDk2NTNjNWMyOTY5NWJmNzYzZjZjZDcxYWZiYjY4MjA3MGEx
|
14
|
+
MmM3ZTBiMzRkZjEyOTAzNzk0YjRkMjZiNjNkMzgwNTVkZTMwMjAzZTA2OTZh
|
15
|
+
YjcwZTI2MTI5ZmUzMzg3Y2Y0ZWY4ZWY0Nzc4MzU4ODcyMTE4Y2E=
|
data/CHANGES
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
2013-03-26 - 1.1.
|
2
|
-
* Easier access to color attributes via color(123) or
|
1
|
+
2013-03-26 - 1.1.4 * Easier access to color attributes via color(123) or
|
3
2
|
approximate html colors like color('#336caf').
|
3
|
+
2013-03-26 - 1.1.3 * Fix a bug where respond_to could overflow the stack.
|
4
4
|
2013-03-25 - 1.1.2 * Change the API: color0 - color255 to color(:color0) -
|
5
5
|
color(:color255), and on_color0 to on_color(:color0) -
|
6
6
|
on_color(:color255); the previous way caused some
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/lib/term/ansicolor.rb
CHANGED
@@ -185,12 +185,7 @@ module Term
|
|
185
185
|
# color +name+. If string isn't a string only the escape sequence to switch
|
186
186
|
# on the color +name+ is returned.
|
187
187
|
def color(name, string = nil, &block)
|
188
|
-
attribute = Attribute.
|
189
|
-
attribute ||=
|
190
|
-
name.to_s =~ /\Aon_/ ?
|
191
|
-
Attribute.nearest_rgb_on_color(name) :
|
192
|
-
Attribute.nearest_rgb_color(name)
|
193
|
-
attribute or raise ArgumentError, "unknown attribute #{name.inspect}"
|
188
|
+
attribute = Attribute[name] or raise ArgumentError, "unknown attribute #{name.inspect}"
|
194
189
|
result = ''
|
195
190
|
result << "\e[#{attribute.code}m" if Term::ANSIColor.coloring?
|
196
191
|
if block_given?
|
data/term-ansicolor.gemspec
CHANGED
data/tests/ansicolor_test.rb
CHANGED
@@ -56,6 +56,13 @@ class ANSIColorTest < Test::Unit::TestCase
|
|
56
56
|
assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(:color128) { "foo" }
|
57
57
|
assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) { "foo" }
|
58
58
|
assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) + "foo" + color(:reset)
|
59
|
+
assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128, "foo")
|
60
|
+
assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128)
|
61
|
+
assert_equal "\e[38;5;128mfoo\e[0m", color(128, "foo")
|
62
|
+
assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128) { "foo" }
|
63
|
+
assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128) { "foo" }
|
64
|
+
assert_equal "\e[38;5;128mfoo\e[0m", color(128) { "foo" }
|
65
|
+
assert_equal "\e[38;5;128mfoo\e[0m", color(128) + "foo" + color(:reset)
|
59
66
|
end
|
60
67
|
|
61
68
|
def test_on_color
|
@@ -66,6 +73,13 @@ class ANSIColorTest < Test::Unit::TestCase
|
|
66
73
|
assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(:color128) { "foo" }
|
67
74
|
assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) { "foo" }
|
68
75
|
assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) + "foo" + color(:reset)
|
76
|
+
assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128, "foo")
|
77
|
+
assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128)
|
78
|
+
assert_equal "\e[48;5;128mfoo\e[0m", on_color(128, "foo")
|
79
|
+
assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128) { "foo" }
|
80
|
+
assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128) { "foo" }
|
81
|
+
assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) { "foo" }
|
82
|
+
assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) + "foo" + color(:reset)
|
69
83
|
end
|
70
84
|
|
71
85
|
def test_uncolor
|