pigment 0.1.5 → 0.1.7
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.
- data/README.md +7 -0
- data/lib/pigment.rb +5 -5
- metadata +3 -2
data/README.md
ADDED
data/lib/pigment.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pigment
|
2
|
-
VERSION = '0.1.
|
2
|
+
VERSION = '0.1.7'
|
3
3
|
|
4
4
|
class Color
|
5
5
|
|
@@ -136,7 +136,7 @@ module Pigment
|
|
136
136
|
def -(color)
|
137
137
|
case color
|
138
138
|
when Color
|
139
|
-
self.class.new(*self.class.supress([
|
139
|
+
self.class.new(*self.class.supress([rgb, color.rgb].transpose.map! do |c, d|
|
140
140
|
e = c - d
|
141
141
|
e >= 0 ? e : e = 1 + e
|
142
142
|
e
|
@@ -176,7 +176,7 @@ module Pigment
|
|
176
176
|
# @param [Color] color
|
177
177
|
# @return [Boolean]
|
178
178
|
def ==(color)
|
179
|
-
color.is_a?
|
179
|
+
color.is_a?(Color) && color.rgb == rgb
|
180
180
|
end
|
181
181
|
|
182
182
|
# Converts a color to its grayscale correspondent
|
@@ -210,7 +210,7 @@ module Pigment
|
|
210
210
|
# @param [Float] amount
|
211
211
|
def interpolate(color, amount = 0.5)
|
212
212
|
if color.is_a? Color && (-1.0..1.0).include?(amount)
|
213
|
-
n = [
|
213
|
+
n = [rgb, color.rgb].transpose.map! { |c, d| c + amount * (d - c) }
|
214
214
|
self.class.new(*self.class.supress(n))
|
215
215
|
else
|
216
216
|
raise ArgumentError
|
@@ -220,7 +220,7 @@ module Pigment
|
|
220
220
|
# Returns the Invert color
|
221
221
|
# @return [Color]
|
222
222
|
def inverse
|
223
|
-
self.class.new(
|
223
|
+
self.class.new(*rgb.map { |c| 1.0 - c })
|
224
224
|
end
|
225
225
|
|
226
226
|
# Returns a new Color without the given channels
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pigment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -23,7 +23,8 @@ extra_rdoc_files: []
|
|
23
23
|
files:
|
24
24
|
- lib/colors.rb
|
25
25
|
- lib/pigment.rb
|
26
|
-
|
26
|
+
- README.md
|
27
|
+
homepage: https://github.com/SilverPhoenix99/pigment
|
27
28
|
licenses: []
|
28
29
|
post_install_message:
|
29
30
|
rdoc_options: []
|