colorable 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6024686c3981c957bb138847ba67d2943adadb8
4
- data.tar.gz: 029c94b3397060f4321958147b1a6e5baae8ddca
3
+ metadata.gz: ac8fe28fac5a9c9eee459a8927d35e94146ed21d
4
+ data.tar.gz: cd1262d7726f2cfd0003a0b486115c36cb4223f2
5
5
  SHA512:
6
- metadata.gz: ae001ada0b61e3c6ecc74c8fa5245b2a1ba0eb340685144b1dc31d0a1d29114bcbd22c223683d59b4052f819578a7e61bdb05e8897c9993a694b8f79b1f93fe1
7
- data.tar.gz: 4274459a95d0525945e2ba700074ced011f0eb1ea30b5ecf837875047d6c96c25793afbe2b2af2d1dd54629c3ad55c53ffc8132d65c3ead72a580fd1d9c9e892
6
+ metadata.gz: 9abd7f790c84433b91e95cf3aae951960b355311be9436be65686ee375233611742edcdc53ca4cb1089b74ea8ea5465d5bac89bc47d99ae19920cacc085d46cf
7
+ data.tar.gz: 72d843af6dc8e343a96142b78700e2167b99eaa59da813a43b2170e9d94cf7321f737b910327eff8413d2e52fbb603f0c9f3325ca3c16754b42cce55c61d149d
@@ -78,6 +78,7 @@ module Colorable
78
78
  when :name then :NAME
79
79
  when :rgb, *rgb_part then :RGB
80
80
  when :hsb, :hsv, *hsb_part then :HSB
81
+ when :hex then :HEX
81
82
  else
82
83
  raise ArgumentError, "Invalid order option given"
83
84
  end
@@ -92,7 +93,7 @@ module Colorable
92
93
  ->color{ color.rgb.move_to_top rgb_part.index(order) }
93
94
  when *hsb_part
94
95
  ->color{ color.hsb.move_to_top hsb_part.index(order) }
95
- when :name, :rgb, :hsb, :hsv
96
+ when :name, :rgb, :hsb, :hsv, :hex
96
97
  ->color{ color.send order }
97
98
  end
98
99
 
@@ -105,6 +106,5 @@ module Colorable
105
106
  raise ArgumentError, "Invalid dir option given"
106
107
  end
107
108
  end
108
-
109
109
  end
110
110
  end
@@ -1,3 +1,3 @@
1
1
  module Colorable
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -112,6 +112,12 @@ describe Color do
112
112
  it { @c.next(2).to_s.should eql "hsb(60,6,100)" } #Ivory
113
113
  end
114
114
 
115
+ context "with :HEX mode" do
116
+ subject { Color.new '#32CD32' }
117
+ it { subject.next.to_s.should eql "#3CB371" }
118
+ it { subject.next(2).to_s.should eql "#40E0D0" }
119
+ end
120
+
115
121
  context "when color is not in X11 colorset" do
116
122
  it { Color.new([100,10,10]).name.should be_nil }
117
123
  end
@@ -139,6 +145,12 @@ describe Color do
139
145
  it { @c.prev(2).to_s.should eql "hsb(55,20,100)" } #Lemon Chiffon
140
146
  end
141
147
 
148
+ context "with :HEX mode" do
149
+ subject { Color.new '#32CD32' }
150
+ it { subject.prev.to_s.should eql "#2F4F4F" }
151
+ it { subject.prev(2).to_s.should eql "#2E8B57" }
152
+ end
153
+
142
154
  context "when color is not in X11 colorset" do
143
155
  it { Color.new([100,10,10]).name.should be_nil }
144
156
  end
@@ -32,6 +32,12 @@ describe Colorset do
32
32
  it { subject.take(3).map(&:to_s).should eql ['hsb(0,0,0)', 'hsb(0,0,41)', 'hsb(0,0,50)'] }
33
33
  it { subject.last.to_s.should eql 'hsb(352,29,100)' }
34
34
  end
35
+
36
+ context "with HEX order" do
37
+ subject { Colorset.new order: :hex }
38
+ it { subject.take(3).map(&:to_s).should eql ["#000000", "#000080", "#00008B"] }
39
+ it { subject.last.to_s.should eql '#FFFFFF' }
40
+ end
35
41
  end
36
42
 
37
43
  describe "#at" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyoendo