colorable 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -17
- data/lib/colorable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4862f2760ecd40037e08051beda7ced338b1c589
|
4
|
+
data.tar.gz: f4882f6046fd30d8c098199ccc7681768013cff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9142e066151a08d31ce9b57107d47d1f640432631267f70db272625eaade9bca54da1f7e750686666b1180f6b7e33cd28c4d7fe9bc4524a3c68cfd720226ce8c
|
7
|
+
data.tar.gz: bba5baf4843abe1c52112b3fc1ee78c4f09066b2b6fb28015ce456aee93cf19e5fc72f653d1693876ef23a44eac2d3262e1e55842cfa6c9bf12201474ba56519
|
data/README.md
CHANGED
@@ -23,31 +23,31 @@ Create a color object:
|
|
23
23
|
require "colorable"
|
24
24
|
|
25
25
|
# Accept X11 color names
|
26
|
-
c = Colorable::Color.new(:green)
|
27
|
-
c
|
28
|
-
c.
|
29
|
-
c.
|
30
|
-
c.
|
26
|
+
c = Colorable::Color.new(:green) #=> #<Colorable::Color:0x007fa449954ee0 @name="Green", @rgb=[0, 255, 0], @hex=nil, @hsb=nil, @esc=nil>
|
27
|
+
c.name #=> "Green"
|
28
|
+
c.hsb #=> [120, 100, 100]
|
29
|
+
c.hex #=> "#00FF00"
|
30
|
+
c.to_s #=> "rgb(0,255,0)"
|
31
31
|
|
32
32
|
# or RGB
|
33
|
-
c2 = Colorable::Color.new([240, 248, 255])
|
34
|
-
c2
|
35
|
-
c2.
|
36
|
-
c2.
|
37
|
-
c2.
|
38
|
-
c2.
|
33
|
+
c2 = Colorable::Color.new([240, 248, 255]) #=> #<Colorable::Color:0x007fa449a69c90 @name="Alice Blue", @rgb=[240, 248, 255], @hex=nil, @hsb=nil, @esc=nil>
|
34
|
+
c2.name #=> "Alice Blue"
|
35
|
+
c2.rgb #=> [240, 248, 255]
|
36
|
+
c2.hsb #=> [208, 6, 100]
|
37
|
+
c2.hex #=> "#F0F8FF"
|
38
|
+
c2.to_s #=> "rgb(240,248,255)"
|
39
39
|
|
40
40
|
Create a colorset object:
|
41
41
|
|
42
42
|
# Default colorset sequence is by its color name order.
|
43
|
-
cs = Colorable::Colorset.new
|
44
|
-
cs.at
|
45
|
-
10.times.map { cs.next.name }
|
43
|
+
cs = Colorable::Colorset.new #=> #<Colorset 0/144 pos='Alice Blue:rgb(240,248,255)'>
|
44
|
+
cs.at #=> #<Colorable::Color:0x007fa448beb2b8 @name="Alice Blue", @rgb=[240, 248, 255], @hex=nil, @hsb=nil, @esc=nil>
|
45
|
+
10.times.map { cs.next.name } #=> ["Antique White", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque", "Black", "Blanched Almond", "Blue", "Blue Violet"]
|
46
46
|
|
47
47
|
# Using Colorset#[], the order of the sequence is specified.
|
48
|
-
cs2 = Colorable::Colorset[:hsb]
|
49
|
-
cs2.at
|
50
|
-
10.times.map { cs2.next.hsb }
|
48
|
+
cs2 = Colorable::Colorset[:hsb] #=> #<Colorset 0/144 pos='Black:rgb(0,0,0)'>
|
49
|
+
cs2.at #=> #<Colorable::Color:0x007fa448a913e0 @name="Black", @rgb=[0, 0, 0], @hex=nil, @hsb=[0, 0, 0], @esc=nil>
|
50
|
+
10.times.map { cs2.next.hsb } #=> [[0, 0, 41], [0, 0, 50], [0, 0, 66], [0, 0, 75], [0, 0, 75], [0, 0, 83], [0, 0, 86], [0, 0, 96], [0, 0, 100], [0, 2, 100]]
|
51
51
|
|
52
52
|
|
53
53
|
## Contributing
|
data/lib/colorable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colorable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyoendo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|