rb_colors 0.1.0
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 +7 -0
- data/.gitignore +36 -0
- data/.travis.yml +4 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +27 -0
- data/README.md +218 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rb_colors.rb +5 -0
- data/lib/rb_colors/color.rb +213 -0
- data/lib/rb_colors/palette/base.rb +14 -0
- data/lib/rb_colors/palette/primary.rb +18 -0
- data/lib/rb_colors/palette/rainbow.rb +16 -0
- data/lib/rb_colors/palette/w3c.rb +156 -0
- data/lib/rb_colors/version.rb +3 -0
- data/rb_colors.gemspec +36 -0
- metadata +106 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: be115723216a957e215d0dccb80284d8a62010e5
|
|
4
|
+
data.tar.gz: 40b61ba1869568f40008c55d1b293c23e301cd6e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f0722191ee6323300b9b76936fc5d310a1914d035e08168f1bbc09ff6c842f5c2bf250f034c08228034786d8d4938999aa6ee53b20873ec9d6078411b252e3b2
|
|
7
|
+
data.tar.gz: fb8edf456261043523c525307a9ca79696cdb04944fd21fe4e43677894adceaab1f7edad1353bc1ced1aae158f771062fe2e81ff5e85f9226f32e5222f8c418d
|
data/.gitignore
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
## Specific to RubyMotion:
|
|
14
|
+
.dat*
|
|
15
|
+
.repl_history
|
|
16
|
+
build/
|
|
17
|
+
|
|
18
|
+
## Documentation cache and generated files:
|
|
19
|
+
/.yardoc/
|
|
20
|
+
/_yardoc/
|
|
21
|
+
/doc/
|
|
22
|
+
/rdoc/
|
|
23
|
+
|
|
24
|
+
## Environment normalisation:
|
|
25
|
+
/.bundle/
|
|
26
|
+
/vendor/bundle
|
|
27
|
+
/lib/bundler/man/
|
|
28
|
+
|
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
31
|
+
# .ruby-version
|
|
32
|
+
# .ruby-gemset
|
|
33
|
+
# Gemfile.lock
|
|
34
|
+
|
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
36
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
rb_colors (0.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
codecov (0.1.1)
|
|
10
|
+
json
|
|
11
|
+
simplecov
|
|
12
|
+
url
|
|
13
|
+
docile (1.1.5)
|
|
14
|
+
json (1.8.3)
|
|
15
|
+
minitest (5.8.1)
|
|
16
|
+
rake (10.4.2)
|
|
17
|
+
simplecov (0.10.0)
|
|
18
|
+
docile (~> 1.1.0)
|
|
19
|
+
json (~> 1.8)
|
|
20
|
+
simplecov-html (~> 0.10.0)
|
|
21
|
+
simplecov-html (0.10.0)
|
|
22
|
+
url (0.3.2)
|
|
23
|
+
|
|
24
|
+
PLATFORMS
|
|
25
|
+
ruby
|
|
26
|
+
|
|
27
|
+
DEPENDENCIES
|
|
28
|
+
bundler (~> 1.10)
|
|
29
|
+
codecov
|
|
30
|
+
minitest
|
|
31
|
+
rake (~> 10.0)
|
|
32
|
+
rb_colors!
|
|
33
|
+
|
|
34
|
+
BUNDLED WITH
|
|
35
|
+
1.10.6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2015, lord63
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of [project] nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# RbColors
|
|
2
|
+
|
|
3
|
+
[![Latest Version][1]][2]
|
|
4
|
+
[![Build Status][3]][4]
|
|
5
|
+
[![Coverage Status][5]][6]
|
|
6
|
+
|
|
7
|
+
Convert colors between rgb, hsv and hex, perform arithmetic, blend modes, and
|
|
8
|
+
generate random colors within boundaries. This is a ruby implementation for the
|
|
9
|
+
original [colors.py][].
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
gem 'rb_colors'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
And then execute:
|
|
20
|
+
|
|
21
|
+
$ bundle
|
|
22
|
+
|
|
23
|
+
Or install it yourself as:
|
|
24
|
+
|
|
25
|
+
$ gem install rb_colors
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
To use RbColors:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
require "rb_colors"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Basic
|
|
36
|
+
|
|
37
|
+
#### RGBColor, HSVColor, HexColor
|
|
38
|
+
|
|
39
|
+
I'll take the RGBColor as an example to show you the basic usages.
|
|
40
|
+
|
|
41
|
+
create and RGB color object
|
|
42
|
+
|
|
43
|
+
> rgb_color = RbColors::RGBColor.new(100, 100, 100)
|
|
44
|
+
=> #<RbColors::RGBColor:0x00000001364b50 @red=100, @green=100, @blue=100>
|
|
45
|
+
|
|
46
|
+
get the red color, green color or blue color
|
|
47
|
+
|
|
48
|
+
> rgb_color.red
|
|
49
|
+
=> 100
|
|
50
|
+
|
|
51
|
+
convert it to HSVColor
|
|
52
|
+
|
|
53
|
+
> rgb_color.hsv
|
|
54
|
+
=> #<RbColors::HSVColor:0x00000000ef98e0 @hue=0.0, @saturation=0.0, @value=0.39215686274509803>
|
|
55
|
+
|
|
56
|
+
convert it to HexColor
|
|
57
|
+
|
|
58
|
+
> rgb_color.hex
|
|
59
|
+
=> #<RbColors::HexColor:0x00000000effc40 @red="64", @green="64", @blue="64">
|
|
60
|
+
|
|
61
|
+
the string representing of a color
|
|
62
|
+
|
|
63
|
+
> rgb_color.to_s
|
|
64
|
+
=> "<RbColors::RGBColor @red: 100, @green: 100, @blue: 100>"
|
|
65
|
+
|
|
66
|
+
get the rgb value array
|
|
67
|
+
|
|
68
|
+
> rgb_color.to_a
|
|
69
|
+
=> [100, 100, 100]
|
|
70
|
+
|
|
71
|
+
#### ColorWheel
|
|
72
|
+
|
|
73
|
+
The color wheel allows you to randomly choose colors while keeping the colors
|
|
74
|
+
relatively evenly distributed. Think generating random colors without pooling in
|
|
75
|
+
one hue, e.g., not 50 green, and 1 red.
|
|
76
|
+
|
|
77
|
+
> color_wheel = RbColors::ColorWheel.new
|
|
78
|
+
=> #<RbColors::ColorWheel:0x000000013a5240 @phase=0>
|
|
79
|
+
> color_wheel.next
|
|
80
|
+
=> #<RbColors::HSVColor:0x0000000139ee18 @hue=0.1130311042805524, @saturation=1, @value=0.8>
|
|
81
|
+
> color_wheel.next
|
|
82
|
+
=> #<RbColors::HSVColor:0x00000001381ca0 @hue=0.2755130313932345, @saturation=1, @value=0.8>
|
|
83
|
+
|
|
84
|
+
#### RandomColor
|
|
85
|
+
|
|
86
|
+
generate a random HSVColor
|
|
87
|
+
|
|
88
|
+
> RbColors::RandomColor.rand
|
|
89
|
+
=> #<RbColors::HSVColor:0x000000013ef430 @hue=0.1951741813062533, @saturation=0.20363532841868148, @value=0.48843165752999573>
|
|
90
|
+
|
|
91
|
+
### Arithmetic
|
|
92
|
+
|
|
93
|
+
Note: All arithmetic operations return RGBColor.
|
|
94
|
+
|
|
95
|
+
#### Add
|
|
96
|
+
|
|
97
|
+
> RbColors::RGBColor.new(10, 10, 10) + RbColors::RGBColor.new(10, 10, 10)
|
|
98
|
+
=> #<RbColors::RGBColor:0x00000001ead318 @red=20, @green=20, @blue=20>
|
|
99
|
+
|
|
100
|
+
#### Substract
|
|
101
|
+
|
|
102
|
+
> RbColors::RGBColor.new(10, 10, 10) - RbColors::RGBColor.new(10, 10, 10)
|
|
103
|
+
=> #<RbColors::RGBColor:0x00000001e3fb38 @red=0, @green=0, @blue=0>
|
|
104
|
+
|
|
105
|
+
#### Multiply
|
|
106
|
+
|
|
107
|
+
> RbColors::RGBColor.new(10, 10, 10) * RbColors::RGBColor.new(10, 10, 10)
|
|
108
|
+
=> #<RbColors::RGBColor:0x00000001519720 @red=0.39215686274509803, @green=0.39215686274509803, @blue=0.39215686274509803>
|
|
109
|
+
|
|
110
|
+
#### Divid
|
|
111
|
+
|
|
112
|
+
> RbColors::RGBColor.new(10, 10, 10) / RbColors::RGBColor.new(10, 10, 10)
|
|
113
|
+
=> #<RbColors::RGBColor:0x00000001dfc4a0 @red=1.0, @green=1.0, @blue=1.0>
|
|
114
|
+
|
|
115
|
+
### Blend modes
|
|
116
|
+
|
|
117
|
+
Read the souce code at `rb_colors/color.rb RbColors::Color` if you feel puzzled ;)
|
|
118
|
+
|
|
119
|
+
Note: All arithmetic operations return RGBColor.
|
|
120
|
+
|
|
121
|
+
#### Screen
|
|
122
|
+
|
|
123
|
+
> RbColors::HexColor.new('ff9999').screen(RbColors::RGBColor.new(10, 10, 10)).hex
|
|
124
|
+
=> #<RbColors::HexColor:0x000000015d0628 @red="ff", @green="9d", @blue="9d">
|
|
125
|
+
|
|
126
|
+
#### Difference
|
|
127
|
+
|
|
128
|
+
> RbColors::HexColor.new('ff9999').difference(RbColors::RGBColor.new(10, 10, 10)).hex
|
|
129
|
+
=> #<RbColors::HexColor:0x000000015a5c20 @red="f5", @green="8f", @blue="8f">
|
|
130
|
+
|
|
131
|
+
#### Overlay
|
|
132
|
+
|
|
133
|
+
> RbColors::HexColor.new('ff9999').overlay(RbColors::RGBColor.new(10, 10, 10)).hex
|
|
134
|
+
=> #<RbColors::HexColor:0x0000000158cb30 @red="ff", @green="9b", @blue="9b">
|
|
135
|
+
|
|
136
|
+
#### Invert
|
|
137
|
+
|
|
138
|
+
> RbColors::HexColor.new('000000').invert
|
|
139
|
+
=> #<RbColors::RGBColor:0x0000000153ce78 @red=255, @green=255, @blue=255>
|
|
140
|
+
|
|
141
|
+
### Color palettes
|
|
142
|
+
|
|
143
|
+
`rb_colors` current ships with three color palettes full of constants. Get all the
|
|
144
|
+
available colors of a palette via `RbColors::ColorPalette.colors`.
|
|
145
|
+
|
|
146
|
+
#### RbColors::Primary
|
|
147
|
+
|
|
148
|
+
> RbColors::Primary.colors
|
|
149
|
+
=> [:BLACK, :WHITE, :RED, :GREEN, :BLUE]
|
|
150
|
+
> RbColors::Primary::RED
|
|
151
|
+
=> #<RbColors::RGBColor:0x00000001c88420 @red=255, @green=0, @blue=0>
|
|
152
|
+
|
|
153
|
+
#### RbColors::Rainbow
|
|
154
|
+
|
|
155
|
+
> RbColors::Rainbow.colors
|
|
156
|
+
=> [:RED, :ORANGE, :YELLOW, :GREEN, :BLUE, :INDIGO, :VIOLET]
|
|
157
|
+
> RbColors::Rainbow::INDIGO
|
|
158
|
+
=> #<RbColors::RGBColor:0x00000001c583d8 @red=75, @green=0, @blue=130>
|
|
159
|
+
|
|
160
|
+
#### RbColors::W3C
|
|
161
|
+
|
|
162
|
+
> RbColors::W3C.colors
|
|
163
|
+
=> [:ALICEBLUE, :ANTIQUEWHITE, :AQUA, :AQUAMARINE, :AZURE, :BEIGE, ...]
|
|
164
|
+
> RbColors::W3C::GHOSTWHITE
|
|
165
|
+
=> #<RbColors::RGBColor:0x00000001c1e728 @red=248, @green=248, @blue=255>
|
|
166
|
+
|
|
167
|
+
## Classes
|
|
168
|
+
|
|
169
|
+
- RbColors::Color | superclass for RGB, HSV, Hex color
|
|
170
|
+
- RbColors::RGBColor | RGB color
|
|
171
|
+
- RbColors::HSVColor | HSV color
|
|
172
|
+
- RbColors::HexColor | Hex color
|
|
173
|
+
- RbColors::ColorPalette | superclass for Primary, Rainbow, W3C palette
|
|
174
|
+
- RbColors::Primary | the Primary palette
|
|
175
|
+
- RbColors::Rainbow | the Rainbow palette
|
|
176
|
+
- RbColors::W3C | the W3C palette
|
|
177
|
+
- RbColors::ColorWheel | randomly choose colors while keeping the colors relatively evenly distributed
|
|
178
|
+
- RbColors::RandomColor | generate a random HSVColor
|
|
179
|
+
- RbColors::ColorSys | convert between rgb and hsv color, port from python's colorsys module
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
184
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
|
185
|
+
prompt that will allow you to experiment.
|
|
186
|
+
|
|
187
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
188
|
+
release a new version, update the version number in `version.rb`, and then run
|
|
189
|
+
`bundle exec rake release`, which will create a git tag for the version, push git
|
|
190
|
+
commits and tags, and push the `.gem` file to [rubygems.org][].
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
* It sucks? Why not help me improve it? Let me know the bad things.
|
|
195
|
+
* Want a new feature? Feel free to file an issue for a feature request.
|
|
196
|
+
* Find a bug? Open an issue please, or it's better if you can send me a pull request.
|
|
197
|
+
|
|
198
|
+
Contributions are always welcome at any time! :sparkles: :cake: :sparkles:
|
|
199
|
+
Bug reports and pull requests are welcome on GitHub at [lord63/rb_colors][].
|
|
200
|
+
|
|
201
|
+
## Kudos
|
|
202
|
+
|
|
203
|
+
All the glories should belong to [@mattrobenolt][], I just port it to python :)
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
BSD3
|
|
208
|
+
|
|
209
|
+
[1]: https://badge.fury.io/rb/rb_colors.svg
|
|
210
|
+
[2]: http://badge.fury.io/rb/rb_colors
|
|
211
|
+
[3]: https://travis-ci.org/lord63/rb_colors.svg?branch=master
|
|
212
|
+
[4]: https://travis-ci.org/lord63/rb_colors
|
|
213
|
+
[5]: https://codecov.io/github/lord63/rb_colors/coverage.svg?branch=master
|
|
214
|
+
[6]: https://codecov.io/github/lord63/rb_colors?branch=master
|
|
215
|
+
[colors.py]: https://github.com/mattrobenolt/colors.py
|
|
216
|
+
[rubygems.org]: https://rubygems.org
|
|
217
|
+
[lord63/rb_colors]: https://github.com/lord63/rb_colors
|
|
218
|
+
[@mattrobenolt]: https://github.com/mattrobenolt
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "rb_colors"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/rb_colors.rb
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
module RbColors
|
|
2
|
+
# The ColorSys module is ported from python's colorsys module.
|
|
3
|
+
module ColorSys
|
|
4
|
+
def self.rgb_to_hsv(r, g, b)
|
|
5
|
+
max_color = [r, g, b].max
|
|
6
|
+
min_color = [r, g, b].min
|
|
7
|
+
v = max_color
|
|
8
|
+
return [0.0, 0.0, v] if max_color == min_color
|
|
9
|
+
s = (max_color - min_color) / max_color
|
|
10
|
+
rc = (max_color - r) / (max_color - min_color)
|
|
11
|
+
gc = (max_color - g) / (max_color - min_color)
|
|
12
|
+
bc = (max_color - b) / (max_color - min_color)
|
|
13
|
+
if r == max_color
|
|
14
|
+
h = bc - gc
|
|
15
|
+
elsif g == max_color
|
|
16
|
+
h = 2.0 + rc - bc
|
|
17
|
+
else
|
|
18
|
+
h = 4.0 + gc - rc
|
|
19
|
+
end
|
|
20
|
+
h = (h / 6.0) % 1.0
|
|
21
|
+
[h, s, v]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.hsv_to_rgb(h, s, v)
|
|
25
|
+
return [v, v, v] if s == 0.0
|
|
26
|
+
i = (h * 6.0).to_i
|
|
27
|
+
f = (h * 6.0) - i
|
|
28
|
+
p = v * (1.0 - s)
|
|
29
|
+
q = v * (1.0 - s * f)
|
|
30
|
+
t = v * (1.0 - s * (1.0 - f))
|
|
31
|
+
i = i % 6
|
|
32
|
+
case i
|
|
33
|
+
when 0
|
|
34
|
+
[v, t, p]
|
|
35
|
+
when 1
|
|
36
|
+
[q, v, p]
|
|
37
|
+
when 2
|
|
38
|
+
[p, v, t]
|
|
39
|
+
when 3
|
|
40
|
+
[p, q, v]
|
|
41
|
+
when 4
|
|
42
|
+
[t, p, v]
|
|
43
|
+
when 5
|
|
44
|
+
[v, p, q]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class Color
|
|
50
|
+
def hex
|
|
51
|
+
HexColor.new('%02x%02x%02x' % rgb.to_a)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def rgb
|
|
55
|
+
raise NotImplementedError
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def hsv
|
|
59
|
+
raise NotImplementedError
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def screen(other)
|
|
63
|
+
self_rgb = rgb.to_a
|
|
64
|
+
other_rgb = other.rgb.to_a
|
|
65
|
+
new_color = self_rgb.zip(other_rgb).map do |i, j|
|
|
66
|
+
255 - ((255 - i) * (255 - j) / 255.0)
|
|
67
|
+
end
|
|
68
|
+
RGBColor.new(*new_color)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def difference(other)
|
|
72
|
+
self_rgb = rgb.to_a
|
|
73
|
+
other_rgb = other.rgb.to_a
|
|
74
|
+
RGBColor.new(*self_rgb.zip(other_rgb).map { |i, j| (i - j).abs })
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def overlay(other)
|
|
78
|
+
screen(self * other)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def invert
|
|
82
|
+
difference(RGBColor.new(255, 255, 255))
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def +(other)
|
|
86
|
+
self_rgb = rgb.to_a
|
|
87
|
+
other_rgb = other.rgb.to_a
|
|
88
|
+
RGBColor.new(*self_rgb.zip(other_rgb).map { |i, j| [255, i + j].min })
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def -(other)
|
|
92
|
+
self_rgb = rgb.to_a
|
|
93
|
+
other_rgb = other.rgb.to_a
|
|
94
|
+
RGBColor.new(*self_rgb.zip(other_rgb).map { |i, j| [0, i - j].max })
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def *(other)
|
|
98
|
+
self_rgb = rgb.to_a
|
|
99
|
+
other_rgb = other.rgb.to_a
|
|
100
|
+
RGBColor.new(*self_rgb.zip(other_rgb).map { |i, j| i * j / 255.0 })
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def /(other)
|
|
104
|
+
self_rgb = rgb.to_a
|
|
105
|
+
other_rgb = other.rgb.to_a
|
|
106
|
+
raise ZeroDivisionError, "0 in #{other}" if other_rgb.include? 0
|
|
107
|
+
RGBColor.new(*self_rgb.zip(other_rgb).map { |i, j| i / j.to_f })
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def to_s
|
|
111
|
+
values = instance_variables.map { |var| instance_variable_get var }
|
|
112
|
+
properties = instance_variables.zip(values).map do |variable, value|
|
|
113
|
+
"#{variable}: #{value}"
|
|
114
|
+
end
|
|
115
|
+
"<#{self.class} #{properties.join(', ')}>"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def to_a
|
|
119
|
+
instance_variables.map { |var| instance_variable_get var }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def ==(other)
|
|
123
|
+
rgb.to_a == other.rgb.to_a
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
class HSVColor < Color
|
|
128
|
+
attr_reader :hue, :saturation, :value
|
|
129
|
+
|
|
130
|
+
def initialize(h = 0, s = 0, v = 0)
|
|
131
|
+
raise ArgumentError, 'Saturation has to be less than 1' if s > 1
|
|
132
|
+
raise ArgumentError, 'Value has to be less than 1' if v > 1
|
|
133
|
+
h -= h.to_i if h >= 1 # Hue can safely circle around 1
|
|
134
|
+
@hue = h
|
|
135
|
+
@saturation = s
|
|
136
|
+
@value = v
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def rgb
|
|
140
|
+
RGBColor.new(*(ColorSys.hsv_to_rgb(*to_a).map { |c| c * 255 }))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def hsv
|
|
144
|
+
self
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
class RGBColor < Color
|
|
149
|
+
attr_reader :red, :green, :blue
|
|
150
|
+
|
|
151
|
+
def initialize(r = 0, g = 0, b = 0)
|
|
152
|
+
@red = r
|
|
153
|
+
@green = g
|
|
154
|
+
@blue = b
|
|
155
|
+
to_a.each do |c|
|
|
156
|
+
if c < 0 || c > 255
|
|
157
|
+
raise ArgumentError, 'Color values must be between 0 and 255.'
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def rgb
|
|
163
|
+
self
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def hsv
|
|
167
|
+
HSVColor.new(*(ColorSys.rgb_to_hsv(*(to_a.map { |c| c / 255.0 }))))
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
class HexColor < RGBColor
|
|
172
|
+
def initialize(hex = '000000')
|
|
173
|
+
raise ArgumentError, 'Hex color must be 6 digits.' unless hex.size == 6
|
|
174
|
+
raise ArgumentError, 'Not a valid hex number.' unless /\h{6}/ =~ hex
|
|
175
|
+
@red, @green, @blue = hex.scan(/../)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def rgb
|
|
179
|
+
RGBColor.new(*(to_a.map { |c| c.to_i(16) }))
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def hsv
|
|
183
|
+
RGBColor.new(*(to_a.map { |c| c.to_i(16) })).hsv
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def hex
|
|
187
|
+
self
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def to_str
|
|
191
|
+
'%s%s%s' % to_a
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
class ColorWheel
|
|
196
|
+
def initialize(start = 0)
|
|
197
|
+
@phase = start > 1 ? start - 1 : start
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def next
|
|
201
|
+
shift = Random.rand * 0.1 + 0.1
|
|
202
|
+
@phase += shift
|
|
203
|
+
@phase = @phase > 1 ? @phase - 1 : @phase
|
|
204
|
+
HSVColor.new(@phase, 1, 0.8)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
class RandomColor
|
|
209
|
+
def self.rand
|
|
210
|
+
HSVColor.new(*3.times.map { Random.rand })
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module RbColors
|
|
2
|
+
class ColorPalette
|
|
3
|
+
# Get all the color constants in a color palette.
|
|
4
|
+
def self.colors
|
|
5
|
+
@colors.keys
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.const_missing(name)
|
|
9
|
+
# Use a cache to make sure that we always get the same object for a color.
|
|
10
|
+
return @cached_color[name] if @cached_color.key? name
|
|
11
|
+
@cached_color[name] = RGBColor.new(*@colors[name]) if @colors.key? name
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'rb_colors/palette/base'
|
|
2
|
+
|
|
3
|
+
module RbColors
|
|
4
|
+
class Primary < ColorPalette
|
|
5
|
+
# Each color palette should have their own cache, in case that they
|
|
6
|
+
# will cache other color which has the same name in other palettes,
|
|
7
|
+
# e.g. GREEN color in RbColors::Primary and RbColors::Rainbow, the
|
|
8
|
+
# rgb value is different from each other.
|
|
9
|
+
@cached_color = {}
|
|
10
|
+
@colors = {
|
|
11
|
+
BLACK: [0, 0, 0],
|
|
12
|
+
WHITE: [255, 255, 255],
|
|
13
|
+
RED: [255, 0, 0],
|
|
14
|
+
GREEN: [0, 255, 0],
|
|
15
|
+
BLUE: [0, 0, 255]
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'rb_colors/palette/base'
|
|
2
|
+
|
|
3
|
+
module RbColors
|
|
4
|
+
class Rainbow < ColorPalette
|
|
5
|
+
@cached_color = {}
|
|
6
|
+
@colors = {
|
|
7
|
+
RED: [255, 0, 0],
|
|
8
|
+
ORANGE: [255, 165, 0],
|
|
9
|
+
YELLOW: [255, 255, 0],
|
|
10
|
+
GREEN: [0, 128, 0],
|
|
11
|
+
BLUE: [0, 0, 255],
|
|
12
|
+
INDIGO: [75, 0, 130],
|
|
13
|
+
VIOLET: [238, 130, 238]
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
require 'rb_colors/palette/base'
|
|
2
|
+
|
|
3
|
+
module RbColors
|
|
4
|
+
class W3C < ColorPalette
|
|
5
|
+
@cached_color = {}
|
|
6
|
+
@colors = {
|
|
7
|
+
ALICEBLUE: [240, 248, 255],
|
|
8
|
+
ANTIQUEWHITE: [250, 235, 215],
|
|
9
|
+
AQUA: [0, 255, 255],
|
|
10
|
+
AQUAMARINE: [127, 255, 212],
|
|
11
|
+
AZURE: [240, 255, 255],
|
|
12
|
+
BEIGE: [245, 245, 220],
|
|
13
|
+
BISQUE: [255, 228, 196],
|
|
14
|
+
BLACK: [0, 0, 0],
|
|
15
|
+
BLANCHEDALMOND: [255, 235, 205],
|
|
16
|
+
BLUE: [0, 0, 255],
|
|
17
|
+
BLUEVIOLET: [138, 43, 226],
|
|
18
|
+
BROWN: [165, 42, 42],
|
|
19
|
+
BURLYWOOD: [222, 184, 135],
|
|
20
|
+
CADETBLUE: [95, 158, 160],
|
|
21
|
+
CHARTREUSE: [127, 255, 0],
|
|
22
|
+
CHOCOLATE: [210, 105, 30],
|
|
23
|
+
CORAL: [255, 127, 80],
|
|
24
|
+
CORNFLOWERBLUE: [100, 149, 237],
|
|
25
|
+
CORNSILK: [255, 248, 220],
|
|
26
|
+
CRIMSON: [220, 20, 60],
|
|
27
|
+
CYAN: [0, 255, 255],
|
|
28
|
+
DARKBLUE: [0, 0, 139],
|
|
29
|
+
DARKCYAN: [0, 139, 139],
|
|
30
|
+
DARKGOLDENROD: [184, 134, 11],
|
|
31
|
+
DARKGRAY: [169, 169, 169],
|
|
32
|
+
DARKGREY: [169, 169, 169],
|
|
33
|
+
DARKGREEN: [0, 100, 0],
|
|
34
|
+
DARKKHAKI: [189, 183, 107],
|
|
35
|
+
DARKMAGENTA: [139, 0, 139],
|
|
36
|
+
DARKOLIVEGREEN: [85, 107, 47],
|
|
37
|
+
DARKORANGE: [255, 140, 0],
|
|
38
|
+
DARKORCHID: [153, 50, 204],
|
|
39
|
+
DARKRED: [139, 0, 0],
|
|
40
|
+
DARKSALMON: [233, 150, 122],
|
|
41
|
+
DARKSEAGREEN: [143, 188, 143],
|
|
42
|
+
DARKSLATEBLUE: [72, 61, 139],
|
|
43
|
+
DARKSLATEGRAY: [47, 79, 79],
|
|
44
|
+
DARKSLATEGREY: [47, 79, 79],
|
|
45
|
+
DARKTURQUOISE: [0, 206, 209],
|
|
46
|
+
DARKVIOLET: [148, 0, 211],
|
|
47
|
+
DEEPPINK: [255, 20, 147],
|
|
48
|
+
DEEPSKYBLUE: [0, 191, 255],
|
|
49
|
+
DIMGRAY: [105, 105, 105],
|
|
50
|
+
DIMGREY: [105, 105, 105],
|
|
51
|
+
DODGERBLUE: [30, 144, 255],
|
|
52
|
+
FIREBRICK: [178, 34, 34],
|
|
53
|
+
FLORALWHITE: [255, 250, 240],
|
|
54
|
+
FORESTGREEN: [34, 139, 34],
|
|
55
|
+
FUCHSIA: [255, 0, 255],
|
|
56
|
+
GAINSBORO: [220, 220, 220],
|
|
57
|
+
GHOSTWHITE: [248, 248, 255],
|
|
58
|
+
GOLD: [255, 215, 0],
|
|
59
|
+
GOLDENROD: [218, 165, 32],
|
|
60
|
+
GRAY: [128, 128, 128],
|
|
61
|
+
GREY: [128, 128, 128],
|
|
62
|
+
GREEN: [0, 128, 0],
|
|
63
|
+
GREENYELLOW: [173, 255, 47],
|
|
64
|
+
HONEYDEW: [240, 255, 240],
|
|
65
|
+
HOTPINK: [255, 105, 180],
|
|
66
|
+
INDIANRED: [205, 92, 92],
|
|
67
|
+
INDIGO: [75, 0, 130],
|
|
68
|
+
IVORY: [255, 255, 240],
|
|
69
|
+
KHAKI: [240, 230, 140],
|
|
70
|
+
LAVENDER: [230, 230, 250],
|
|
71
|
+
LAVENDERBLUSH: [255, 240, 245],
|
|
72
|
+
LAWNGREEN: [124, 252, 0],
|
|
73
|
+
LEMONCHIFFON: [255, 250, 205],
|
|
74
|
+
LIGHTBLUE: [173, 216, 230],
|
|
75
|
+
LIGHTCORAL: [240, 128, 128],
|
|
76
|
+
LIGHTCYAN: [224, 255, 255],
|
|
77
|
+
LIGHTGOLDENRODYELLOW: [250, 250, 210],
|
|
78
|
+
LIGHTGRAY: [211, 211, 211],
|
|
79
|
+
LIGHTGREY: [211, 211, 211],
|
|
80
|
+
LIGHTGREEN: [144, 238, 144],
|
|
81
|
+
LIGHTPINK: [255, 182, 193],
|
|
82
|
+
LIGHTSALMON: [255, 160, 122],
|
|
83
|
+
LIGHTSEAGREEN: [32, 178, 170],
|
|
84
|
+
LIGHTSKYBLUE: [135, 206, 250],
|
|
85
|
+
LIGHTSLATEGRAY: [119, 136, 153],
|
|
86
|
+
LIGHTSLATEGREY: [119, 136, 153],
|
|
87
|
+
LIGHTSTEELBLUE: [176, 196, 222],
|
|
88
|
+
LIGHTYELLOW: [255, 255, 224],
|
|
89
|
+
LIME: [0, 255, 0],
|
|
90
|
+
LIMEGREEN: [50, 205, 50],
|
|
91
|
+
LINEN: [250, 240, 230],
|
|
92
|
+
MAGENTA: [255, 0, 255],
|
|
93
|
+
MAROON: [128, 0, 0],
|
|
94
|
+
MEDIUMAQUAMARINE: [102, 205, 170],
|
|
95
|
+
MEDIUMBLUE: [0, 0, 205],
|
|
96
|
+
MEDIUMORCHID: [186, 85, 211],
|
|
97
|
+
MEDIUMPURPLE: [147, 112, 219],
|
|
98
|
+
MEDIUMSEAGREEN: [60, 179, 113],
|
|
99
|
+
MEDIUMSLATEBLUE: [123, 104, 238],
|
|
100
|
+
MEDIUMSPRINGGREEN: [0, 250, 154],
|
|
101
|
+
MEDIUMTURQUOISE: [72, 209, 204],
|
|
102
|
+
MEDIUMVIOLETRED: [199, 21, 133],
|
|
103
|
+
MIDNIGHTBLUE: [25, 25, 112],
|
|
104
|
+
MINTCREAM: [245, 255, 250],
|
|
105
|
+
MISTYROSE: [255, 228, 225],
|
|
106
|
+
MOCCASIN: [255, 228, 181],
|
|
107
|
+
NAVAJOWHITE: [255, 222, 173],
|
|
108
|
+
NAVY: [0, 0, 128],
|
|
109
|
+
OLDLACE: [253, 245, 230],
|
|
110
|
+
OLIVE: [128, 128, 0],
|
|
111
|
+
OLIVEDRAB: [107, 142, 35],
|
|
112
|
+
ORANGE: [255, 165, 0],
|
|
113
|
+
ORANGERED: [255, 69, 0],
|
|
114
|
+
ORCHID: [218, 112, 214],
|
|
115
|
+
PALEGOLDENROD: [238, 232, 170],
|
|
116
|
+
PALEGREEN: [152, 251, 152],
|
|
117
|
+
PALETURQUOISE: [175, 238, 238],
|
|
118
|
+
PALEVIOLETRED: [219, 112, 147],
|
|
119
|
+
PAPAYAWHIP: [255, 239, 213],
|
|
120
|
+
PEACHPUFF: [255, 218, 185],
|
|
121
|
+
PERU: [205, 133, 63],
|
|
122
|
+
PINK: [255, 192, 203],
|
|
123
|
+
PLUM: [221, 160, 221],
|
|
124
|
+
POWDERBLUE: [176, 224, 230],
|
|
125
|
+
PURPLE: [128, 0, 128],
|
|
126
|
+
RED: [255, 0, 0],
|
|
127
|
+
ROSYBROWN: [188, 143, 143],
|
|
128
|
+
ROYALBLUE: [65, 105, 225],
|
|
129
|
+
SADDLEBROWN: [139, 69, 19],
|
|
130
|
+
SALMON: [250, 128, 114],
|
|
131
|
+
SANDYBROWN: [244, 164, 96],
|
|
132
|
+
SEAGREEN: [46, 139, 87],
|
|
133
|
+
SEASHELL: [255, 245, 238],
|
|
134
|
+
SIENNA: [160, 82, 45],
|
|
135
|
+
SILVER: [192, 192, 192],
|
|
136
|
+
SKYBLUE: [135, 206, 235],
|
|
137
|
+
SLATEBLUE: [106, 90, 205],
|
|
138
|
+
SLATEGRAY: [112, 128, 144],
|
|
139
|
+
SLATEGREY: [112, 128, 144],
|
|
140
|
+
SNOW: [255, 250, 250],
|
|
141
|
+
SPRINGGREEN: [0, 255, 127],
|
|
142
|
+
STEELBLUE: [70, 130, 180],
|
|
143
|
+
TAN: [210, 180, 140],
|
|
144
|
+
TEAL: [0, 128, 128],
|
|
145
|
+
THISTLE: [216, 191, 216],
|
|
146
|
+
TOMATO: [255, 99, 71],
|
|
147
|
+
TURQUOISE: [64, 224, 208],
|
|
148
|
+
VIOLET: [238, 130, 238],
|
|
149
|
+
WHEAT: [245, 222, 179],
|
|
150
|
+
WHITE: [255, 255, 255],
|
|
151
|
+
WHITESMOKE: [245, 245, 245],
|
|
152
|
+
YELLOW: [255, 255, 0],
|
|
153
|
+
YELLOWGREEN: [154, 205, 50]
|
|
154
|
+
}
|
|
155
|
+
end
|
|
156
|
+
end
|
data/rb_colors.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'rb_colors/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "rb_colors"
|
|
8
|
+
spec.version = RbColors::VERSION
|
|
9
|
+
spec.authors = ["lord63"]
|
|
10
|
+
spec.email = ["lord63.j@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Yet another library that deals with colors.}
|
|
13
|
+
spec.description = <<-EOF
|
|
14
|
+
Convert colors between rgb, hsv and hex, perform arithmetic, blend modes,
|
|
15
|
+
and generate random colors within boundaries.
|
|
16
|
+
EOF
|
|
17
|
+
spec.homepage = "https://github.com/lord63/rb_colors"
|
|
18
|
+
spec.license = "BSD3"
|
|
19
|
+
|
|
20
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
21
|
+
# delete this section to allow pushing this gem to any host.
|
|
22
|
+
if spec.respond_to?(:metadata)
|
|
23
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
|
24
|
+
else
|
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
29
|
+
spec.bindir = "exe"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "minitest"
|
|
36
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rb_colors
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- lord63
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: minitest
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: " Convert colors between rgb, hsv and hex, perform arithmetic, blend
|
|
56
|
+
modes,\n\tand generate random colors within boundaries.\n"
|
|
57
|
+
email:
|
|
58
|
+
- lord63.j@gmail.com
|
|
59
|
+
executables: []
|
|
60
|
+
extensions: []
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".travis.yml"
|
|
65
|
+
- Gemfile
|
|
66
|
+
- Gemfile.lock
|
|
67
|
+
- LICENSE
|
|
68
|
+
- README.md
|
|
69
|
+
- Rakefile
|
|
70
|
+
- bin/console
|
|
71
|
+
- bin/setup
|
|
72
|
+
- lib/rb_colors.rb
|
|
73
|
+
- lib/rb_colors/color.rb
|
|
74
|
+
- lib/rb_colors/palette/base.rb
|
|
75
|
+
- lib/rb_colors/palette/primary.rb
|
|
76
|
+
- lib/rb_colors/palette/rainbow.rb
|
|
77
|
+
- lib/rb_colors/palette/w3c.rb
|
|
78
|
+
- lib/rb_colors/version.rb
|
|
79
|
+
- rb_colors.gemspec
|
|
80
|
+
homepage: https://github.com/lord63/rb_colors
|
|
81
|
+
licenses:
|
|
82
|
+
- BSD3
|
|
83
|
+
metadata:
|
|
84
|
+
allowed_push_host: https://rubygems.org
|
|
85
|
+
post_install_message:
|
|
86
|
+
rdoc_options: []
|
|
87
|
+
require_paths:
|
|
88
|
+
- lib
|
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - ">="
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '0'
|
|
99
|
+
requirements: []
|
|
100
|
+
rubyforge_project:
|
|
101
|
+
rubygems_version: 2.4.6
|
|
102
|
+
signing_key:
|
|
103
|
+
specification_version: 4
|
|
104
|
+
summary: Yet another library that deals with colors.
|
|
105
|
+
test_files: []
|
|
106
|
+
has_rdoc:
|