rgbcell 0.5 → 0.6
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 +4 -4
- data/README.md +11 -7
- data/lib/rgbcell.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da5fd72fb01b31511616620f70d832b1072f849650b67c42cbb299b46dbbeb6e
|
|
4
|
+
data.tar.gz: a7e51036067dc362f3bb3786f7d6601439cf1559542f6b717fdd314f65b815d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5c5ba5b3f7fd671fa6b641d9ab82dfcd1e8ba6b3638a4f0526d922095e38bcbc3d7c20d3aa2b4d820db5abcf254a9469907180ebc9bf4ca8a723087e0b16df9
|
|
7
|
+
data.tar.gz: 6b4b772dd5689ea6d08ffa8eefb7ab26b67591414dc61351c14f2e7d086fce6fbd0abd3f81ae8f0febac4824a79e691f2d22697e3fa955f9d7e0f8ddbb25aada
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
RGBCell represents a color as the coordinates in the x-y-z coordinate system.
|
|
4
4
|
Each of the three component color elements, red, green, and blue, have a float
|
|
5
|
-
value from 0 to
|
|
5
|
+
value from 0 to 255.
|
|
6
6
|
|
|
7
7
|
Creating an object without any params creates black:
|
|
8
8
|
|
|
@@ -34,7 +34,10 @@ You can indicate the color using hex format:
|
|
|
34
34
|
color.green #=> 255.0
|
|
35
35
|
color.blue #=> 0.0
|
|
36
36
|
|
|
37
|
-
You can give one of the HTML named colors
|
|
37
|
+
You can give one of the HTML named colors. All 140 official named HTML colors
|
|
38
|
+
are available. See
|
|
39
|
+
[W3C's page](https://www.w3.org/wiki/CSS/Properties/color/keywords)
|
|
40
|
+
for the complete list.
|
|
38
41
|
|
|
39
42
|
color = RGBCell.new('purple')
|
|
40
43
|
color.to_s #=> #800080
|
|
@@ -42,7 +45,7 @@ You can give one of the HTML named colors:
|
|
|
42
45
|
color.green #=> 0.0
|
|
43
46
|
color.blue #=> 128.0
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
You can use 'random' to get a random color:
|
|
46
49
|
|
|
47
50
|
color = RGBCell.new('random')
|
|
48
51
|
color.to_s #=> #dbd25b
|
|
@@ -50,8 +53,8 @@ Finally, you can use 'random' to get a random color:
|
|
|
50
53
|
color.green #=> 210.0
|
|
51
54
|
color.blue #=> 91.0
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
Finally, you can also set each component color individually. Notice in this
|
|
57
|
+
example that an integer value is converted to float.
|
|
55
58
|
|
|
56
59
|
color = RGBCell.new()
|
|
57
60
|
color.red = 60 #=> 60.0
|
|
@@ -63,7 +66,7 @@ a component integer value is converted to float.
|
|
|
63
66
|
|
|
64
67
|
Because every color is a set of coordinates, the difference between two colors
|
|
65
68
|
can be expressed as a distance. The distance is always zero or a positive
|
|
66
|
-
number. For example, the following
|
|
69
|
+
number. For example, the following code gives the distance between red and
|
|
67
70
|
chartreuse.
|
|
68
71
|
|
|
69
72
|
red = RGBCell.new('red')
|
|
@@ -116,4 +119,5 @@ mike@idocs.com
|
|
|
116
119
|
|
|
117
120
|
| version | date | notes |
|
|
118
121
|
|---------|---------------|-------------------------------------------------------|
|
|
119
|
-
| 0.5 | June 25, 2020 | Initial upload. |
|
|
122
|
+
| 0.5 | June 25, 2020 | Initial upload. |
|
|
123
|
+
| 0.6 | June 26, 2020 | Edits to documentation. |
|
data/lib/rgbcell.rb
CHANGED