decolmor 1.2.0 → 1.3.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
  SHA256:
3
- metadata.gz: 4394b870f83f01ebe74db59131475d1d9a72bd32d307e36b775f903fbfe95b67
4
- data.tar.gz: e9aad1484b539e938e666de21bd5eb1a630118646b3391da4d40d95a473ea766
3
+ metadata.gz: 9bad9f3f292018ddb773baabedc9fd9d7cd6da14d7932dae3768640124ec8c0a
4
+ data.tar.gz: 1846c3b81edf98d162ce5c3ac8be9a48475f60d35c4ca57c83ae0c3590fd79c1
5
5
  SHA512:
6
- metadata.gz: 939483bfc049fefab624f9ed62e10b081684ce020a3b0d96189036eb20747386f9693c831221684eb1403eeb0af899e29382459798fd3bbbebdbf232f8976aec
7
- data.tar.gz: 606d35831d04dea98b8405e176240d2cf4ceedd9f7684170b0c972fc9b7db97964ab2c5080de897d3308b900fd5d0b9aeaafb1f8ce5ad899147f320796d6a45a
6
+ metadata.gz: a3bb07b37d6f970dd81c29cd4aca46f01d8eb6131cd2f2516f43b8e618ef18d4c65ea72c5a26c51f1c0b7ee6b1f63df3f21931fc886610100eb8815eac2e4119
7
+ data.tar.gz: a3984305b33fd84a30ef1faee7129bcb4da307ee702830f69cf1873f9c0557e6dceee25238d054d42e16deba276e24d1d9293cf9ed6a7b92546ef2a10da079ef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 (September 27, 2021)
4
+
5
+ * Added support HSI <==> RGB
6
+ > _RGB => HSI when rounding 1 ~2k RGB colors will be slightly different, 2 will fix this_
7
+ * Added methods for HEX <==> HSL/HSV/HSB/HSI/CMYK
8
+ * Fixed incorrect conversion to RGB when HUE == 360
9
+ it was about the methods:
10
+ * hsl_to_rgb_alt
11
+ * hsv_to_rgb_alt
12
+ and new:
13
+ * hsi_to_rgb
14
+
3
15
  ## 1.2.0 (September 21, 2021)
4
16
 
5
17
  * `.hex_to_rgb` now support a returnable alpha in range `0..255`
data/NEWS.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # News
2
2
 
3
+ ## 1.3.0 (September 27, 2021)
4
+
5
+ * added support HSI <==> RGB
6
+ * added methods for HEX <==> HSL/HSV/HSB/HSI/CMYK
7
+
3
8
  ## 1.2.0 (September 21, 2021)
4
9
 
5
10
  * `.hex_to_rgb` now support a returnable alpha in range `0..255`
data/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
  [![badge-codecov][badge-codecov]][codecov]
5
5
  [![badge-license][badge-license]][license]
6
6
 
7
- Gem for converting color spaces from/to: HEX/RGB/HSL/HSV/HSB/CMYK
7
+ Gem for converting color spaces from/to: HEX/RGB/HSL/HSV/HSB/HSI/CMYK
8
8
  The Alpha channel (transparency) is supported.
9
9
  There is also a simple RGB generator.
10
10
 
11
- [News][news] | [Recent releases][releases] | [Changelog][changelog] | [Wiki][wiki]
11
+ [News][news] . [Recent releases][releases] . [Changelog][changelog] . [Wiki][wiki]
12
12
 
13
13
  ## Install
14
14
  Add the following line to Gemfile:
@@ -50,9 +50,10 @@ Gem methods will be available as class methods.
50
50
 
51
51
  See [WIKI](https://github.com/ChildrenofkoRn/decolmor/wiki/Examples) for more examples.
52
52
 
53
- ## Rounding for HSL/HSV/HSB/CMYK
54
- By default, rounding 1 is used to convert to HSL/HSV/HSB/CMYK.
55
- This is enough to loselessly convert RGB -> HSL/HSV/HSB/CMYK -> RGB:
53
+ ## Rounding for HSL/HSV/HSB/HSI/CMYK
54
+ By default, rounding 1 is used to convert to HSL/HSV/HSB/HSI/CMYK.
55
+ This is enough to loselessly convert RGB -> HSL/HSV/HSB/HSI/CMYK -> RGB:
56
+ * _for HSI this is not quite true ~2k (of 16.6M) RGB colors will be slightly different, rounding 2 fixes this._
56
57
  ```ruby
57
58
  rgb = [224, 23, 131]
58
59
  hsl = Decolmor.rgb_to_hsl(rgb) # => [327.8, 81.4, 48.4]
@@ -75,7 +76,7 @@ You can also specify rounding as a second argument when calling the method:
75
76
  In this case, the global rounding will be ignored.
76
77
  If you need to get integers, use 0.
77
78
 
78
- ## HEX to RGB(A)
79
+ ## HEX to
79
80
  - with & without prefix `#`
80
81
  - short HEX are supported (including Alpha)
81
82
  - can be set rounding for the Alpha channel
@@ -97,11 +98,16 @@ You can also set rounding for Alpha channel as a second argument:
97
98
  ```ruby
98
99
  Decolmor.hex_to_rgb('#19988BB8', 2) # => [25, 152, 139, 0.72]
99
100
  ```
100
- This only works for converting HEX to RGBA.
101
- In other cases (conversions between RGB/HSL/HSV/HSB/CMYK) Alpha channel remains unchanged.
101
+ This only works for converting from HEX.
102
+ In other cases (conversions between RGB/HSL/HSV/HSB/HSI/CMYK) Alpha channel remains unchanged.
102
103
 
103
- ## HSV or HSB
104
- HSB is an alternative name for HSV, it is the same thing.
104
+ ## HSL, HSI, HSV or HSB
105
+ **HSL**, **HSI**, **HSV** - are three _different_ color spaces.
106
+ They have only one common parameter **HUE**.
107
+ **S** - **Suturation**, despite the same name, is _different_ in all three spaces,
108
+ like the last component: **Lightness** / **Intensity** / **Value** (**Brightness**).
109
+
110
+ **HSB** is an alternative name for **HSV**, it is the same thing.
105
111
  However, for convenience, aliasing methods are made for HSB from HSV.
106
112
  ```ruby
107
113
  rgb = [255, 109, 55]
@@ -119,7 +125,7 @@ or
119
125
  - hsv_to_rgb_alt
120
126
  - hsb_to_rgb_alt
121
127
 
122
- The results of the two implementations are identical, but the alternative versions (postfix `_alt`) are ~1.35X slower.
128
+ The results of the two implementations are identical, but the alternative versions (postfix `_alt`) are slightly slower.
123
129
 
124
130
  ## Attention for CMYK !
125
131
  Unfortunately, there is no simple formula for linear RGB to/from CMYK conversion.
@@ -127,7 +133,7 @@ This implementation is a simplified/dirty/simulation.
127
133
  CMYK is used for printing and the correct conversion will be non-linear, based on the color profile for the particular printing device.
128
134
  Therefore, the CMYK conversion results will not match Adobe products.
129
135
  **BUT:**
130
- Conversion from/to HEX/RGB/HSL/HSV/HSB is simple and is described by formulas.
136
+ Conversion from/to HEX/RGB/HSL/HSV/HSB/HSI is simple and is described by formulas.
131
137
  Read more: https://en.wikipedia.org/wiki/HSL_and_HSV
132
138
  The results when rounded to an integer will be the same as when using graphics editors, such as CorelDRAW or Adobe Photoshop.
133
139
 
@@ -139,14 +145,16 @@ The results when rounded to an integer will be the same as when using graphics e
139
145
  - rgb_to_hex
140
146
  - Simple generator RGB, you can set any channel(s)
141
147
  - new_rgb
142
- - RGB(A) to HSL/HSV/HSB
148
+ - RGB(A) to HSL/HSV/HSB/HSI
143
149
  - rgb_to_hsl
144
150
  - rgb_to_hsv
145
151
  - rgb_to_hsb
146
- - HSL/HSV/HSB to RGB(A)
152
+ - rgb_to_hsi
153
+ - HSL/HSV/HSB/HSI to RGB(A)
147
154
  - hsl_to_rgb
148
155
  - hsv_to_rgb
149
156
  - hsb_to_rgb
157
+ - hsi_to_rgb
150
158
  - Alternative implementation HSL/HSV/HSB to RGB(A) (a little slower)
151
159
  - hsl_to_rgb_alt
152
160
  - hsv_to_rgb_alt
@@ -159,6 +167,18 @@ The results when rounded to an integer will be the same as when using graphics e
159
167
  - RGB(A) <==> CMYK
160
168
  - rgb_to_cmyk
161
169
  - cmyk_to_rgb
170
+ - HEX => HSL/HSV/HSB/HSI/CMYK
171
+ - hex_to_hsl
172
+ - hex_to_hsv
173
+ - hex_to_hsb
174
+ - hex_to_hsi
175
+ - hex_to_cmyk
176
+ - HSL/HSV/HSB/HSI/CMYK => HEX
177
+ - hsl_to_hex
178
+ - hsv_to_hex
179
+ - hsb_to_hex
180
+ - hsi_to_hex
181
+ - cmyk_to_hex
162
182
 
163
183
  ## License
164
184
  MIT License
@@ -167,8 +187,8 @@ Copyright (c) 2021 ChildrenofkoRn
167
187
 
168
188
 
169
189
 
170
- [gem]: https://badge.fury.io/rb/decolmor "gem version"
171
- [badge-gem]: https://badge.fury.io/rb/decolmor.svg "gem version"
190
+ [gem]: https://rubygems.org/gems/decolmor "gem version"
191
+ [badge-gem]: https://img.shields.io/gem/v/decolmor?color=bri&label=gem%20version&logo=ruby&logoColor=f01f7a "gem version"
172
192
  [codecov]: https://codecov.io/gh/ChildrenofkoRn/decolmor "codecov"
173
193
  [badge-codecov]: https://codecov.io/gh/ChildrenofkoRn/decolmor/branch/main/graph/badge.svg?token=5P4OQUXC3N "codecov"
174
194
  [github-workflow]: https://github.com/ChildrenofkoRn/decolmor/actions/workflows/build.yml "build"
data/decolmor.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |spec|
4
4
  spec.name = 'decolmor'
5
5
  spec.version = Decolmor::VERSION
6
6
  spec.licenses = ['MIT']
7
- spec.summary = "Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/CMYK"
8
- spec.description = "Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/CMYK.\n" \
7
+ spec.summary = "Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/HSI/CMYK"
8
+ spec.description = "Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/HSI/CMYK.\n" \
9
9
  "The Alpha channel (transparency) is supported.\n" \
10
10
  "There is also a simple RGB generator."
11
11
  spec.authors = ["ChildrenofkoRn"]
data/lib/decolmor/main.rb CHANGED
@@ -148,8 +148,8 @@ module Decolmor
148
148
  lightness /= 100
149
149
 
150
150
  # calculation chroma & intermediate values
151
+ hue = (hue % 360) / 60
151
152
  chroma = (1 - (2 * lightness - 1).abs) * saturation
152
- hue /= 60
153
153
  x = chroma * (1 - (hue % 2 - 1).abs)
154
154
  point = get_rgb_point(hue, chroma, x)
155
155
 
@@ -166,8 +166,8 @@ module Decolmor
166
166
  value /= 100
167
167
 
168
168
  # calculation chroma & intermediate values
169
+ hue = (hue % 360) / 60
169
170
  chroma = value * saturation
170
- hue /= 60
171
171
  x = chroma * (1 - (hue % 2 - 1).abs)
172
172
  point = get_rgb_point(hue, chroma, x)
173
173
 
@@ -179,6 +179,56 @@ module Decolmor
179
179
 
180
180
  alias_method :hsb_to_rgb_alt, :hsv_to_rgb_alt
181
181
 
182
+ #========= RGB <==> HSI ================================================
183
+
184
+ def rgb_to_hsi(rgb_arr, rounding = hsx_round)
185
+ # scaling RGB values into range 0..1
186
+ rgb = rgb_arr[0..2].map { |color| color / 255.to_f }
187
+ alpha = rgb_arr[3]
188
+
189
+ # calculation HSI values
190
+ hue = get_hue(*rgb)
191
+ intensity = rgb.sum / 3
192
+ saturation = intensity.zero? ? 0 : 1 - rgb.min / intensity
193
+
194
+ # scaling values to fill 0..100 interval
195
+ saturation *= 100
196
+ intensity *= 100
197
+
198
+ # rounding, drop Alpha if not set (nil)
199
+ hsi = [hue, saturation, intensity].map { |x| x.round(rounding) }
200
+ alpha.nil? ? hsi : hsi + [alpha]
201
+ end
202
+
203
+ def hsi_to_rgb(hsi_arr)
204
+ hue, saturation, intensity, alpha = hsi_arr.map(&:to_f)
205
+ # scaling values into range 0..1
206
+ saturation /= 100
207
+ intensity /= 100
208
+
209
+ # calculation chroma & intermediate values
210
+ #
211
+ # as 360/60 does not get_rgb_point in any of the ranges 0...1 or 5...6
212
+ # so in the method we use (hue % 360)
213
+ # at the same time solving if hue is not in the 0..360 range
214
+ hue = (hue % 360) / 60
215
+ z = 1 - (hue % 2 - 1).abs
216
+ chroma = (3 * intensity * saturation) / (1 + z)
217
+ x = chroma * z
218
+ point = get_rgb_point(hue, chroma, x)
219
+
220
+ # calculation rgb
221
+ m = intensity * (1 - saturation)
222
+ rgb = point.map { |channel| channel + m }
223
+
224
+ # checking rgb on overrange 0..1
225
+ rgb = fix_overrange_rgb(rgb)
226
+ # scaling into range 0..255 & rounding
227
+ rgb.map! { |channel| (channel * 255).round }
228
+
229
+ alpha.nil? ? rgb : rgb + [alpha]
230
+ end
231
+
182
232
  #========= HSL <==> HSV (HSB) ==========================================
183
233
 
184
234
  def hsl_to_hsv(hsl_arr, rounding = hsx_round)
@@ -246,9 +296,55 @@ module Decolmor
246
296
  cmyk_arr.size == 5 ? rgb + [cmyk_arr.last] : rgb
247
297
  end
248
298
 
299
+ #========= HEX <==> HSL/HSV/HSB/HSI ========================================
300
+
301
+ def hex_to_hsl(hex, rounding = hsx_round, alpha_255: false)
302
+ rgb = hex_to_rgb(hex, alpha_255: alpha_255)
303
+ rgb_to_hsl(rgb, rounding)
304
+ end
305
+
306
+ def hsl_to_hex(hsl_arr, alpha_255: false)
307
+ rgb = hsl_to_rgb(hsl_arr)
308
+ rgb_to_hex(rgb, alpha_255: alpha_255)
309
+ end
310
+
311
+ def hex_to_hsv(hex, rounding = hsx_round, alpha_255: false)
312
+ rgb = hex_to_rgb(hex, alpha_255: alpha_255)
313
+ rgb_to_hsv(rgb, rounding)
314
+ end
315
+
316
+ def hsv_to_hex(hsv_arr, alpha_255: false)
317
+ rgb = hsv_to_rgb(hsv_arr)
318
+ rgb_to_hex(rgb, alpha_255: alpha_255)
319
+ end
320
+
321
+ alias_method :hex_to_hsb, :hex_to_hsv
322
+ alias_method :hsb_to_hex, :hsv_to_hex
323
+
324
+ def hex_to_hsi(hex, rounding = hsx_round, alpha_255: false)
325
+ rgb = hex_to_rgb(hex, alpha_255: alpha_255)
326
+ rgb_to_hsi(rgb, rounding)
327
+ end
328
+
329
+ def hsi_to_hex(hsi_arr, alpha_255: false)
330
+ rgb = hsi_to_rgb(hsi_arr)
331
+ rgb_to_hex(rgb, alpha_255: alpha_255)
332
+ end
333
+
334
+ def hex_to_cmyk(hex, rounding = hsx_round, alpha_255: false)
335
+ rgb = hex_to_rgb(hex, alpha_255: alpha_255)
336
+ rgb_to_cmyk(rgb, rounding)
337
+ end
338
+
339
+ def cmyk_to_hex(cmyk_arr, alpha_255: false)
340
+ rgb = cmyk_to_rgb(cmyk_arr)
341
+ rgb_to_hex(rgb, alpha_255: alpha_255)
342
+ end
343
+
344
+
249
345
  private
250
346
 
251
- #========= helper methods for RGB to HSL/HSB/HSV =======================
347
+ #========= helper methods ==============================================
252
348
 
253
349
  # find greatest and smallest channel values and chroma from RGB
254
350
  def get_min_max_chroma(red, green, blue)
@@ -293,9 +389,21 @@ module Decolmor
293
389
  when 3...4 then [0, x, chroma]
294
390
  when 4...5 then [x, 0, chroma]
295
391
  when 5...6 then [chroma, 0, x]
296
- else [0, 0, 0]
392
+ # HUE will never leave the 0..359 range because we use (hue % 360)
393
+ # else [0, 0, 0]
297
394
  end
298
395
  end
396
+
397
+ # checking rgb on overrange 0..1
398
+ def fix_overrange_rgb(rgb)
399
+ max = rgb.max
400
+ # so we keep HUE
401
+ # if we had just used clipping [[value, 255].min, 0].max
402
+ # we would have changed HUE
403
+ #
404
+ # Thx to Rotem & Giacomo Catenazzi from stackoverflow
405
+ max > 1 ? rgb.map { |channel| channel / max } : rgb
406
+ end
299
407
  end
300
408
 
301
409
  extend ClassMethods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decolmor
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
@@ -19,7 +19,7 @@ RSpec.describe Decolmor do
19
19
  Decolmor.hsx_round = 1
20
20
  end
21
21
 
22
- let(:colors) { FactoryBot.build(:colors_map, round: 2) }
22
+ let(:colors) { FactoryBot.build(:colors, round: 2) }
23
23
 
24
24
  it ".hsx_round by default 1" do
25
25
  expect( Decolmor.hsx_round ).to eq 1
@@ -32,7 +32,7 @@ RSpec.describe Decolmor do
32
32
 
33
33
  context 'HEX <==> RGB(A)' do
34
34
  describe ".hex_to_rgb" do
35
- let(:colors) { FactoryBot.build(:colors_map) }
35
+ let(:colors) { FactoryBot.build(:colors) }
36
36
  let(:alphas) { FactoryBot.build(:alpha) }
37
37
 
38
38
  it "HEX w prefix # to RGB" do
@@ -96,7 +96,7 @@ RSpec.describe Decolmor do
96
96
  end
97
97
 
98
98
  describe ".rgb_to_hex" do
99
- let(:colors) { FactoryBot.build(:colors_map) }
99
+ let(:colors) { FactoryBot.build(:colors) }
100
100
  let(:alphas) { FactoryBot.build(:alpha) }
101
101
 
102
102
  it "RGB converts to HEX" do
@@ -127,7 +127,7 @@ RSpec.describe Decolmor do
127
127
  end
128
128
  end
129
129
 
130
-
130
+
131
131
  context 'simple generator RGB, you can set any channel(s)' do
132
132
  describe ".new_rgb" do
133
133
  it "generate RGB with values into range 0..255" do
@@ -152,7 +152,7 @@ RSpec.describe Decolmor do
152
152
 
153
153
  context 'RGB(A) to HSL/HSV/HSB' do
154
154
  describe ".rgb_to_hsl" do
155
- let(:colors) { FactoryBot.build(:colors_map) }
155
+ let(:colors) { FactoryBot.build(:colors) }
156
156
  let(:alphas) { FactoryBot.build(:alpha) }
157
157
 
158
158
  it "RGB converts to HSL" do
@@ -188,9 +188,9 @@ RSpec.describe Decolmor do
188
188
  end
189
189
 
190
190
  describe ".rgb_to_hsv" do
191
- let(:colors) { FactoryBot.build(:colors_map) }
191
+ let(:colors) { FactoryBot.build(:colors) }
192
192
  let(:alphas) { FactoryBot.build(:alpha) }
193
- let(:colors_round_2) { FactoryBot.build(:colors_map, round: 2) }
193
+ let(:colors_round_2) { FactoryBot.build(:colors, round: 2) }
194
194
 
195
195
  it "RGB converts to HSV" do
196
196
  colors.each_pair do |hex, values|
@@ -231,7 +231,7 @@ RSpec.describe Decolmor do
231
231
 
232
232
  context 'HSL/HSV/HSB to RGB(A)' do
233
233
  describe ".hsl_to_rgb" do
234
- let(:colors) { FactoryBot.build(:colors_map) }
234
+ let(:colors) { FactoryBot.build(:colors) }
235
235
  let(:alphas) { FactoryBot.build(:alpha) }
236
236
 
237
237
  it "HSL converts to RGB" do
@@ -250,7 +250,7 @@ RSpec.describe Decolmor do
250
250
  end
251
251
 
252
252
  describe ".hsv_to_rgb" do
253
- let(:colors) { FactoryBot.build(:colors_map) }
253
+ let(:colors) { FactoryBot.build(:colors) }
254
254
  let(:alphas) { FactoryBot.build(:alpha) }
255
255
 
256
256
  it "HSV converts to RGB" do
@@ -278,7 +278,7 @@ RSpec.describe Decolmor do
278
278
 
279
279
  context 'Alternative implementation HSL/HSV/HSB to RGB(A)' do
280
280
  describe ".hsl_to_rgb_alt" do
281
- let(:colors) { FactoryBot.build(:colors_map) }
281
+ let(:colors) { FactoryBot.build(:colors) }
282
282
  let(:alphas) { FactoryBot.build(:alpha) }
283
283
 
284
284
  it "HSL converts to RGB" do
@@ -295,17 +295,22 @@ RSpec.describe Decolmor do
295
295
  end
296
296
  end
297
297
 
298
- it "if hue not a range member 0..360 return identical RGB values (colorless)" do
299
- colors.each_pair do |hex, values|
300
- hsl = values[:hsl]
301
- hsl[0] += 360
302
- expect( Decolmor.hsl_to_rgb_alt(hsl).uniq.size ).to eq 1
303
- end
298
+ it "if hue == 360 we get valid values" do
299
+ rgb_int = [123, 1, 2]
300
+ # the resulting value from hsi with rounding 0 to an integer (hue will be 360)
301
+ # as 360/60 does not get_rgb_point in any of the ranges 0...1 or 5...6
302
+ # so in the method we use (hue % 360)
303
+ # at the same time solving if hue is not in the 0..360 range
304
+ # the fact that rgb_int and rgb_out differ is normal,
305
+ # because with integer HSL values its impossible to losslessly convert back to RGB
306
+ rgb_out = [121, 1, 1]
307
+ hsv = Decolmor.rgb_to_hsl(rgb_int, 0)
308
+ expect( Decolmor.hsl_to_rgb_alt(hsv) ).to eq rgb_out
304
309
  end
305
310
  end
306
311
 
307
312
  describe ".hsv_to_rgb_alt" do
308
- let(:colors) { FactoryBot.build(:colors_map) }
313
+ let(:colors) { FactoryBot.build(:colors) }
309
314
  let(:alphas) { FactoryBot.build(:alpha) }
310
315
 
311
316
  it "HSV converts to RGB" do
@@ -322,12 +327,17 @@ RSpec.describe Decolmor do
322
327
  end
323
328
  end
324
329
 
325
- it "if hue not a range member 0..360 return identical RGB values (colorless)" do
326
- colors.each_pair do |_hex, values|
327
- hsl = values[:hsl]
328
- hsl[0] -= 360
329
- expect( Decolmor.hsl_to_rgb_alt(hsl).uniq.size ).to eq 1
330
- end
330
+ it "if hue == 360 we get valid values" do
331
+ rgb_int = [128, 7, 8]
332
+ # the resulting value from hsi with rounding 0 to an integer (hue will be 360)
333
+ # as 360/60 does not get_rgb_point in any of the ranges 0...1 or 5...6
334
+ # so in the method we use (hue % 360)
335
+ # at the same time solving if hue is not in the 0..360 range
336
+ # the fact that rgb_int and rgb_out differ is normal,
337
+ # because with integer HSV values its impossible to losslessly convert back to RGB
338
+ rgb_out = [128, 6, 6]
339
+ hsv = Decolmor.rgb_to_hsv(rgb_int, 0)
340
+ expect( Decolmor.hsv_to_rgb_alt(hsv) ).to eq rgb_out
331
341
  end
332
342
  end
333
343
 
@@ -339,10 +349,79 @@ RSpec.describe Decolmor do
339
349
  end
340
350
 
341
351
 
352
+ context 'RGB <==> HSI' do
353
+ describe ".rgb_to_hsi" do
354
+ let(:colors) { FactoryBot.build(:colors) }
355
+ let(:alphas) { FactoryBot.build(:alpha) }
356
+ let(:colors_r3) { FactoryBot.build(:colors, round: 3) }
357
+
358
+ it "RGB converts to hsi" do
359
+ colors.each_pair do |hex, values|
360
+ expect( Decolmor.rgb_to_hsi(values[:rgb]) ).to eq values[:hsi]
361
+ end
362
+ end
363
+
364
+ it "alpha channel pass to hsi unchanged" do
365
+ color = colors.keys.sample
366
+ alphas.each_pair do |_hex_alpha, alpha|
367
+ rgba = colors[color][:rgb] + [alpha[:rgb]]
368
+ expect( Decolmor.rgb_to_hsi(rgba).last ).to eq alpha[:rgb]
369
+ end
370
+ end
371
+
372
+ it "you can set rounding for resulting hsi values (default = 1)" do
373
+ colors_r3.each_pair do |hex, values|
374
+ expect( Decolmor.rgb_to_hsi(values[:rgb], 3) ).to eq values[:hsi]
375
+ end
376
+ end
377
+
378
+ it "setting rounding doesn't affect alpha channel" do
379
+ color = colors.keys.sample
380
+ alphas.each_pair do |_hex_alpha, alpha|
381
+ rgba = colors[color][:rgb] + [alpha[:rgb]]
382
+ expect( Decolmor.rgb_to_hsi(rgba, 0).last ).to eq alpha[:rgb]
383
+ end
384
+ end
385
+ end
386
+
387
+ describe ".hsi_to_rgb" do
388
+ let(:colors) { FactoryBot.build(:colors) }
389
+ let(:alphas) { FactoryBot.build(:alpha) }
390
+
391
+ it "hsi converts to RGB" do
392
+ colors.each_pair do |_hex, values|
393
+ expect( Decolmor.hsi_to_rgb(values[:hsi]) ).to eq values[:rgb]
394
+ end
395
+ end
396
+
397
+ it "alpha channel pass to RGB unchanged" do
398
+ color = colors.keys.sample
399
+ alphas.each_pair do |_hex_alpha, values|
400
+ hsia = colors[color][:hsi] + [values[:rgb]]
401
+ expect( Decolmor.hsi_to_rgb(hsia).last ).to eq values[:rgb]
402
+ end
403
+ end
404
+
405
+ it "if hue == 360 we get valid values" do
406
+ rgb_int = [255, 11, 13]
407
+ # the resulting value from hsi with rounding 0 to an integer (hue will be 360)
408
+ # as 360/60 does not get_rgb_point in any of the ranges 0...1 or 5...6
409
+ # so in the method we use (hue % 360)
410
+ # at the same time solving if hue is not in the 0..360 range
411
+ # the fact that rgb_int and rgb_out differ is normal,
412
+ # because with integer HSI values its impossible to losslessly convert back to RGB
413
+ rgb_out = [253, 11, 11]
414
+ hsi = Decolmor.rgb_to_hsi(rgb_int, 0)
415
+ expect( Decolmor.hsi_to_rgb(hsi) ).to eq rgb_out
416
+ end
417
+ end
418
+ end
419
+
420
+
342
421
  context 'HSL <==> HSV (HSB)' do
343
422
  describe ".hsl_to_hsv" do
344
423
  # as for lossless conversion need to use float value with 2 decimal places
345
- let(:colors) { FactoryBot.build(:colors_map, round: 2) }
424
+ let(:colors) { FactoryBot.build(:colors, round: 2) }
346
425
  let(:alphas) { FactoryBot.build(:alpha) }
347
426
 
348
427
  it "HSL converts to HSV" do
@@ -383,7 +462,7 @@ RSpec.describe Decolmor do
383
462
 
384
463
  describe ".hsv_to_hsl" do
385
464
  # as for lossless conversion need to use float value with 2 decimal places
386
- let(:colors) { FactoryBot.build(:colors_map, round: 2) }
465
+ let(:colors) { FactoryBot.build(:colors, round: 2) }
387
466
  let(:alphas) { FactoryBot.build(:alpha) }
388
467
 
389
468
  it "HSV converts to HSL" do
@@ -426,7 +505,7 @@ RSpec.describe Decolmor do
426
505
 
427
506
  context 'RGB(A) <==> CMYK' do
428
507
  describe ".rgb_to_cmyk" do
429
- let(:colors) { FactoryBot.build(:colors_map) }
508
+ let(:colors) { FactoryBot.build(:colors) }
430
509
  let(:alphas) { FactoryBot.build(:alpha) }
431
510
 
432
511
  it "RGB converts to CMYK" do
@@ -461,7 +540,7 @@ RSpec.describe Decolmor do
461
540
  end
462
541
 
463
542
  describe ".cmyk_to_rgb" do
464
- let(:colors) { FactoryBot.build(:colors_map) }
543
+ let(:colors) { FactoryBot.build(:colors) }
465
544
  let(:alphas) { FactoryBot.build(:alpha) }
466
545
 
467
546
  it "CMYK converts to RGB" do
@@ -480,4 +559,163 @@ RSpec.describe Decolmor do
480
559
  end
481
560
  end
482
561
 
562
+
563
+ context 'HEX <==> HSL/HSV/HSB/HSI/CMYK' do
564
+ describe ".hex_to_hsl" do
565
+ let(:color) { FactoryBot.build(:colors, :one) }
566
+
567
+ it "call hex_to_rgb & rgb_to_hsl" do
568
+ hex, values = *color.first
569
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: false}).and_return(values[:rgb])
570
+ expect(Decolmor).to receive(:rgb_to_hsl).with(values[:rgb], Decolmor.hsx_round)
571
+ Decolmor.hex_to_hsl(hex)
572
+ end
573
+
574
+ it "w additional args (rounding, alpha_255) call hex_to_rgb & rgb_to_hsl" do
575
+ hex, values = *color.first
576
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: true}).and_return(values[:rgb])
577
+ expect(Decolmor).to receive(:rgb_to_hsl).with(values[:rgb], 2)
578
+ Decolmor.hex_to_hsl(hex, 2, alpha_255: true)
579
+ end
580
+ end
581
+
582
+ describe ".hsl_to_hex" do
583
+ let(:color) { FactoryBot.build(:colors, :one) }
584
+
585
+ it "call hsl_to_rgb & rgb_to_hex" do
586
+ values = color.first.last
587
+ expect(Decolmor).to receive(:hsl_to_rgb).with(values[:hsl]).and_return(values[:rgb])
588
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: false})
589
+ Decolmor.hsl_to_hex(values[:hsl])
590
+ end
591
+
592
+ it "w additional args (rounding, alpha_255) call hsl_to_rgb & rgb_to_hex" do
593
+ _hex, values = color.first
594
+ expect(Decolmor).to receive(:hsl_to_rgb).with(values[:hsl]).and_return(values[:rgb])
595
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: true})
596
+ Decolmor.hsl_to_hex(values[:hsl], alpha_255: true)
597
+ end
598
+ end
599
+
600
+ describe ".hex_to_hsv" do
601
+ let(:color) { FactoryBot.build(:colors, :one) }
602
+
603
+ it "call hex_to_rgb & rgb_to_hsv" do
604
+ hex, values = *color.first
605
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: false}).and_return(values[:rgb])
606
+ expect(Decolmor).to receive(:rgb_to_hsv).with(values[:rgb], Decolmor.hsx_round)
607
+ Decolmor.hex_to_hsv(hex)
608
+ end
609
+
610
+ it "w additional args (rounding, alpha_255) call hex_to_rgb & rgb_to_hsv" do
611
+ hex, values = *color.first
612
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: true}).and_return(values[:rgb])
613
+ expect(Decolmor).to receive(:rgb_to_hsv).with(values[:rgb], 2)
614
+ Decolmor.hex_to_hsv(hex, 2, alpha_255: true)
615
+ end
616
+ end
617
+
618
+ describe ".hsv_to_hex" do
619
+ let(:color) { FactoryBot.build(:colors, :one) }
620
+
621
+ it "call hsv_to_rgb & rgb_to_hex" do
622
+ values = color.first.last
623
+ expect(Decolmor).to receive(:hsv_to_rgb).with(values[:hsv]).and_return(values[:rgb])
624
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: false})
625
+ Decolmor.hsv_to_hex(values[:hsv])
626
+ end
627
+
628
+ it "w additional args (rounding, alpha_255) call hsv_to_rgb & rgb_to_hex" do
629
+ values = color.first.last
630
+ expect(Decolmor).to receive(:hsv_to_rgb).with(values[:hsv]).and_return(values[:rgb])
631
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: true})
632
+ Decolmor.hsv_to_hex(values[:hsv], alpha_255: true)
633
+ end
634
+ end
635
+
636
+ describe ".hex_to_hsb" do
637
+ it "alias .rgb_to_hsv" do
638
+ expect( Decolmor.method(:hex_to_hsb ).original_name).to eq(:hex_to_hsv)
639
+ end
640
+ end
641
+
642
+ describe ".hsb_to_hex" do
643
+ it "alias .rgb_to_hsv" do
644
+ expect( Decolmor.method(:hsb_to_hex ).original_name).to eq(:hsv_to_hex)
645
+ end
646
+ end
647
+
648
+ describe ".hex_to_hsi" do
649
+ let(:color) { FactoryBot.build(:colors, :one) }
650
+
651
+ it "call hex_to_rgb & rgb_to_hsi" do
652
+ hex, values = *color.first
653
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: false}).and_return(values[:rgb])
654
+ expect(Decolmor).to receive(:rgb_to_hsi).with(values[:rgb], Decolmor.hsx_round)
655
+ Decolmor.hex_to_hsi(hex)
656
+ end
657
+
658
+ it "w additional args (rounding, alpha_255) call hex_to_rgb & rgb_to_hsi" do
659
+ hex, values = *color.first
660
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: true}).and_return(values[:rgb])
661
+ expect(Decolmor).to receive(:rgb_to_hsi).with(values[:rgb], 2)
662
+ Decolmor.hex_to_hsi(hex, 2, alpha_255: true)
663
+ end
664
+ end
665
+
666
+ describe ".hsi_to_hex" do
667
+ let(:color) { FactoryBot.build(:colors, :one) }
668
+
669
+ it "call hsi_to_rgb & rgb_to_hex" do
670
+ values = color.first.last
671
+ expect(Decolmor).to receive(:hsi_to_rgb).with(values[:hsi]).and_return(values[:rgb])
672
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: false})
673
+ Decolmor.hsi_to_hex(values[:hsi])
674
+ end
675
+
676
+ it "w additional args (rounding, alpha_255) call hsi_to_rgb & rgb_to_hex" do
677
+ values = color.first.last
678
+ expect(Decolmor).to receive(:hsi_to_rgb).with(values[:hsi]).and_return(values[:rgb])
679
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: true})
680
+ Decolmor.hsi_to_hex(values[:hsi], alpha_255: true)
681
+ end
682
+ end
683
+
684
+ describe ".hex_to_cmyk" do
685
+ let(:color) { FactoryBot.build(:colors, :one) }
686
+
687
+ it "call hex_to_rgb & rgb_to_cmyk" do
688
+ hex, values = *color.first
689
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: false}).and_return(values[:rgb])
690
+ expect(Decolmor).to receive(:rgb_to_cmyk).with(values[:rgb], Decolmor.hsx_round)
691
+ Decolmor.hex_to_cmyk(hex)
692
+ end
693
+
694
+ it "w additional args (rounding, alpha_255) call hex_to_rgb & rgb_to_cmyk" do
695
+ hex, values = *color.first
696
+ expect(Decolmor).to receive(:hex_to_rgb).with(hex, {alpha_255: true}).and_return(values[:rgb])
697
+ expect(Decolmor).to receive(:rgb_to_cmyk).with(values[:rgb], 2)
698
+ Decolmor.hex_to_cmyk(hex, 2, alpha_255: true)
699
+ end
700
+ end
701
+
702
+ describe ".cmyk_to_hex" do
703
+ let(:color) { FactoryBot.build(:colors, :one) }
704
+
705
+ it "call cmyk_to_rgb & rgb_to_hex" do
706
+ values = color.first.last
707
+ expect(Decolmor).to receive(:cmyk_to_rgb).with(values[:cmyk]).and_return(values[:rgb])
708
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: false})
709
+ Decolmor.cmyk_to_hex(values[:cmyk])
710
+ end
711
+
712
+ it "w additional args (rounding, alpha_255) call cmyk_to_rgb & rgb_to_hex" do
713
+ values = color.first.last
714
+ expect(Decolmor).to receive(:cmyk_to_rgb).with(values[:cmyk]).and_return(values[:rgb])
715
+ expect(Decolmor).to receive(:rgb_to_hex).with(values[:rgb], {alpha_255: true})
716
+ Decolmor.cmyk_to_hex(values[:cmyk], alpha_255: true)
717
+ end
718
+ end
719
+ end
720
+
483
721
  end
@@ -1,78 +1,105 @@
1
1
  FactoryBot.define do
2
- factory :colors_map, class: Hash do
2
+
3
+ factory :colors, class: Hash do
3
4
  skip_create
4
5
 
5
6
  colors_map = {
6
7
  # black
7
8
  "#000000" => {rgb: [ 0, 0, 0], hsl: [ 0.000, 0.000, 0.000],
8
- cmyk: [ 0.000, 0.000, 0.000, 100.000], hsv: [ 0.000, 0.000, 0.000],},
9
+ cmyk: [ 0.000, 0.000, 0.000, 100.000], hsv: [ 0.000, 0.000, 0.000],
10
+ hsi: [ 0.000, 0.000, 0.000]},
9
11
  # white
10
12
  "#FFFFFF" => {rgb: [255, 255, 255], hsl: [ 0.000, 0.000, 100.000],
11
- cmyk: [ 0.000, 0.000, 0.000, 0.000], hsv: [ 0.000, 0.000, 100.000],},
13
+ cmyk: [ 0.000, 0.000, 0.000, 0.000], hsv: [ 0.000, 0.000, 100.000],
14
+ hsi: [ 0.000, 0.000, 100.000]},
12
15
  # red
13
16
  "#FF0000" => {rgb: [255, 0, 0], hsl: [ 0.000, 100.000, 50.000],
14
- cmyk: [ 0.000, 100.000, 100.000, 0.000], hsv: [ 0.000, 100.000, 100.000],},
17
+ cmyk: [ 0.000, 100.000, 100.000, 0.000], hsv: [ 0.000, 100.000, 100.000],
18
+ hsi: [ 0.000, 100.000, 33.333]},
15
19
  # lime
16
20
  "#00FF00" => {rgb: [ 0, 255, 0], hsl: [120.000, 100.000, 50.000],
17
- cmyk: [100.000, 0.000, 100.000, 0.000], hsv: [120.000, 100.000, 100.000],},
21
+ cmyk: [100.000, 0.000, 100.000, 0.000], hsv: [120.000, 100.000, 100.000],
22
+ hsi: [120.000, 100.000, 33.333]},
18
23
  # blue
19
24
  "#0000FF" => {rgb: [ 0, 0, 255], hsl: [240.000, 100.000, 50.000],
20
- cmyk: [100.000, 100.000, 0.000, 0.000], hsv: [240.000, 100.000, 100.000],},
25
+ cmyk: [100.000, 100.000, 0.000, 0.000], hsv: [240.000, 100.000, 100.000],
26
+ hsi: [240.000, 100.000, 33.333]},
21
27
  # yellow
22
28
  "#FFFF00" => {rgb: [255, 255, 0], hsl: [ 60.000, 100.000, 50.000],
23
- cmyk: [ 0.000, 0.000, 100.000, 0.000], hsv: [ 60.000, 100.000, 100.000],},
29
+ cmyk: [ 0.000, 0.000, 100.000, 0.000], hsv: [ 60.000, 100.000, 100.000],
30
+ hsi: [ 60.000, 100.000, 66.667]},
24
31
  # cyan / aqua
25
32
  "#00FFFF" => {rgb: [ 0, 255, 255], hsl: [180.000, 100.000, 50.000],
26
- cmyk: [100.000, 0.000, 0.000, 0.000], hsv: [180.000, 100.000, 100.000],},
33
+ cmyk: [100.000, 0.000, 0.000, 0.000], hsv: [180.000, 100.000, 100.000],
34
+ hsi: [180.000, 100.000, 66.667]},
27
35
  # magenta / fuchsia
28
36
  "#FF00FF" => {rgb: [255, 0, 255], hsl: [300.000, 100.000, 50.000],
29
- cmyk: [ 0.000, 100.000, 0.000, 0.000], hsv: [300.000, 100.000, 100.000],},
37
+ cmyk: [ 0.000, 100.000, 0.000, 0.000], hsv: [300.000, 100.000, 100.000],
38
+ hsi: [300.000, 100.000, 66.667]},
30
39
  # silver
31
40
  "#C0C0C0" => {rgb: [192, 192, 192], hsl: [ 0.000, 0.000, 75.294],
32
- cmyk: [ 0.000, 0.000, 0.000, 24.706], hsv: [ 0.000, 0.000, 75.294],},
41
+ cmyk: [ 0.000, 0.000, 0.000, 24.706], hsv: [ 0.000, 0.000, 75.294],
42
+ hsi: [ 0.000, 0.000, 75.294]},
33
43
  # gray
34
44
  "#808080" => {rgb: [128, 128, 128], hsl: [ 0.000, 0.000, 50.196],
35
- cmyk: [ 0.000, 0.000, 0.000, 49.804], hsv: [ 0.000, 0.000, 50.196],},
45
+ cmyk: [ 0.000, 0.000, 0.000, 49.804], hsv: [ 0.000, 0.000, 50.196],
46
+ hsi: [ 0.000, 0.000, 50.196]},
36
47
  # maroon
37
48
  "#800000" => {rgb: [128, 0, 0], hsl: [ 0.000, 100.000, 25.098],
38
- cmyk: [ 0.000, 100.000, 100.000, 49.804], hsv: [ 0.000, 100.000, 50.196],},
49
+ cmyk: [ 0.000, 100.000, 100.000, 49.804], hsv: [ 0.000, 100.000, 50.196],
50
+ hsi: [ 0.000, 100.000, 16.732]},
39
51
  # olive
40
52
  "#808000" => {rgb: [128, 128, 0], hsl: [ 60.000, 100.000, 25.098],
41
- cmyk: [ 0.000, 0.000, 100.000, 49.804], hsv: [ 60.000, 100.000, 50.196],},
53
+ cmyk: [ 0.000, 0.000, 100.000, 49.804], hsv: [ 60.000, 100.000, 50.196],
54
+ hsi: [ 60.000, 100.000, 33.464]},
42
55
  # green
43
56
  "#008000" => {rgb: [ 0, 128, 0], hsl: [120.000, 100.000, 25.098],
44
- cmyk: [100.000, 0.000, 100.000, 49.804], hsv: [120.000, 100.000, 50.196],},
57
+ cmyk: [100.000, 0.000, 100.000, 49.804], hsv: [120.000, 100.000, 50.196],
58
+ hsi: [120.000, 100.000, 16.732]},
45
59
  # purple
46
60
  "#800080" => {rgb: [128, 0, 128], hsl: [300.000, 100.000, 25.098],
47
- cmyk: [ 0.000, 100.000, 0.000, 49.804], hsv: [300.000, 100.000, 50.196],},
61
+ cmyk: [ 0.000, 100.000, 0.000, 49.804], hsv: [300.000, 100.000, 50.196],
62
+ hsi: [300.000, 100.000, 33.464]},
48
63
  # teal
49
64
  "#008080" => {rgb: [ 0, 128, 128], hsl: [180.000, 100.000, 25.098],
50
- cmyk: [100.000, 0.000, 0.000, 49.804], hsv: [180.000, 100.000, 50.196],},
65
+ cmyk: [100.000, 0.000, 0.000, 49.804], hsv: [180.000, 100.000, 50.196],
66
+ hsi: [180.000, 100.000, 33.464]},
51
67
  # navy
52
68
  "#000080" => {rgb: [ 0, 0, 128], hsl: [240.000, 100.000, 25.098],
53
- cmyk: [100.000, 100.000, 0.000, 49.804], hsv: [240.000, 100.000, 50.196],},
69
+ cmyk: [100.000, 100.000, 0.000, 49.804], hsv: [240.000, 100.000, 50.196],
70
+ hsi: [240.000, 100.000, 16.732]},
54
71
 
55
72
  # some random colors
56
73
  "#E01783" => {rgb: [224, 23, 131], hsl: [327.761, 81.377, 48.431],
57
- cmyk: [ 0.000, 89.732, 41.518, 12.157], hsv: [327.761, 89.732, 87.843],},
74
+ cmyk: [ 0.000, 89.732, 41.518, 12.157], hsv: [327.761, 89.732, 87.843],
75
+ hsi: [327.761, 81.746, 49.412]},
58
76
 
59
77
  "#1D8056" => {rgb: [ 29, 128, 86], hsl: [154.545, 63.057, 30.784],
60
- cmyk: [ 77.344, 0.000, 32.812, 49.804], hsv: [154.545, 77.344, 50.196],},
78
+ cmyk: [ 77.344, 0.000, 32.812, 49.804], hsv: [154.545, 77.344, 50.196],
79
+ hsi: [154.545, 64.198, 31.765]},
61
80
 
62
81
  "#229765" => {rgb: [ 34, 151, 101], hsl: [154.359, 63.243, 36.275],
63
- cmyk: [ 77.483, 0.000, 33.113, 40.784], hsv: [154.359, 77.483, 59.216],},
82
+ cmyk: [ 77.483, 0.000, 33.113, 40.784], hsv: [154.359, 77.483, 59.216],
83
+ hsi: [154.359, 64.336, 37.386]},
64
84
 
65
85
  "#239393" => {rgb: [ 35, 147, 147], hsl: [180.000, 61.538, 35.686],
66
- cmyk: [ 76.190, 0.000, 0.000, 42.353], hsv: [180.000, 76.190, 57.647],},
86
+ cmyk: [ 76.190, 0.000, 0.000, 42.353], hsv: [180.000, 76.190, 57.647],
87
+ hsi: [180.000, 68.085, 43.007]},
67
88
  }
68
89
 
69
90
  transient do
70
91
  round { 1 }
71
92
  end
72
93
 
73
- initialize_with do
74
- colors_map.transform_values do |value|
75
- value.transform_values { |arr| arr.map { |num| num.round(round)} }
94
+ trait :one do
95
+ initialize_with { colors_map.to_a.sample(1).to_h }
96
+ end
97
+
98
+ initialize_with { colors_map }
99
+
100
+ after(:build) do |colors, evaluator|
101
+ colors.transform_values! do |value|
102
+ value.transform_values! { |arr| arr.map { |num| num.round(evaluator.round)} }
76
103
  end
77
104
  end
78
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decolmor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ChildrenofkoRn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '7.0'
95
95
  description: |-
96
- Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/CMYK.
96
+ Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/HSI/CMYK.
97
97
  The Alpha channel (transparency) is supported.
98
98
  There is also a simple RGB generator.
99
99
  email: Rick-ROR@ya.ru
@@ -146,7 +146,7 @@ requirements: []
146
146
  rubygems_version: 3.2.27
147
147
  signing_key:
148
148
  specification_version: 4
149
- summary: 'Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/CMYK'
149
+ summary: 'Converter color spaces from/to: HEX/RGB/HSL/HSV/HSB/HSI/CMYK'
150
150
  test_files:
151
151
  - spec/decolmor_spec.rb
152
152
  - spec/factories/alpha.rb