pigment 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pigment.rb +8 -1
- metadata +1 -1
data/lib/pigment.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pigment
|
2
|
-
VERSION = '0.1.
|
2
|
+
VERSION = '0.1.3'
|
3
3
|
|
4
4
|
class Color
|
5
5
|
|
@@ -42,10 +42,16 @@ module Pigment
|
|
42
42
|
@color[3] = alpha if alpha.is_a?(Float) && (0.0..1.0).include?(alpha)
|
43
43
|
end
|
44
44
|
|
45
|
+
# Returns an array with the rgb components
|
46
|
+
# @return [Array]
|
45
47
|
def rgb
|
46
48
|
@color[0, 3]
|
47
49
|
end
|
48
50
|
|
51
|
+
def hsl
|
52
|
+
@hsl ? @hsl : to_hsl
|
53
|
+
end
|
54
|
+
|
49
55
|
# Return specified color by its name from the named_colors hash.
|
50
56
|
# @param [Symbol] name
|
51
57
|
# @return [Color]
|
@@ -255,6 +261,7 @@ module Pigment
|
|
255
261
|
h += 1 if h < 0
|
256
262
|
h -= 1 if h > 1
|
257
263
|
@hsl = [h, s, l]
|
264
|
+
@hsl
|
258
265
|
end
|
259
266
|
|
260
267
|
# Returns an array of the color components. Alpha value is passed as well if with_alpha is set to true.
|