color 2.0.0.pre.0 → 2.0.0.pre.2
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/CHANGELOG.md +14 -2
- data/CONTRIBUTING.md +37 -23
- data/CONTRIBUTORS.md +1 -0
- data/LICENCE.md +20 -0
- data/Manifest.txt +1 -0
- data/Rakefile +1 -1
- data/SECURITY.md +5 -0
- data/lib/color/rgb/colors.rb +201 -165
- data/lib/color/rgb.rb +7 -21
- data/lib/color/version.rb +1 -1
- data/licenses/dco.txt +34 -0
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331a961b44a39f14962462ee51a7350873b2a1fb87ffebcad1b84e9f7334e3a9
|
4
|
+
data.tar.gz: b429071184007e7d4b30d3940005421715c4743dd568b4c0bb24f49b8224693e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a84c0800ca1f7c8c939a5f30f9865c48a0733e50ca66031235223a8129a6bcb5c59ab0658df4b211166f5468e76b971790dbae0587e8dc0b2df9c94267042c5
|
7
|
+
data.tar.gz: 1b43af53be8e836881f9f80dd7054c3f0472457c0f4728ac283b709a7563502a9bf3c821ce498684f81d845ffbbc90a94fb1f3463f6118572f61daf13bd88abd
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 2.0.0.pre.
|
3
|
+
## 2.0.0.pre.2 / 2025-06-26
|
4
4
|
|
5
5
|
Color 2.0.0 is a major release of the Color library.
|
6
6
|
|
@@ -56,7 +56,10 @@ this release without warning.
|
|
56
56
|
- The `#html` method has been removed from all color classes except Color::RGB.
|
57
57
|
|
58
58
|
- Named RGB colors are no longer defined automatically, but must be loaded
|
59
|
-
explicitly by requiring `color/rgb/colors`. This resolves [#30][issue-30].
|
59
|
+
explicitly by requiring `color/rgb/colors`. This resolves [#30][issue-30]. The
|
60
|
+
use of `Color::RGB#extract_colors`, `Color::RGB.by_hex`, `Color::RGB.by_name`,
|
61
|
+
or `Color::RGB.by_css` will require `color/rgb/colors` automatically as they
|
62
|
+
require the presence of the named colors.
|
60
63
|
|
61
64
|
- `Color:CSS#[]` has been removed, as has the containing namespace. It has
|
62
65
|
always been a shallow wrapper around `Color::RGB.by_name`.
|
@@ -76,6 +79,14 @@ this release without warning.
|
|
76
79
|
automated releases are enabled), full GitHub Actions, Dependabot, Standard
|
77
80
|
Ruby, and more.
|
78
81
|
|
82
|
+
- Charles Nutter re-added JRuby support in CI. [#36][pr-36]
|
83
|
+
|
84
|
+
### Governance
|
85
|
+
|
86
|
+
Color 2.0 and later requires that all contributions be signed-off attesting that
|
87
|
+
the developer created the change and has the appropriate permissions or
|
88
|
+
ownership to contribute it to this project under the licence terms.
|
89
|
+
|
79
90
|
## 1.8 / 2015-10-26
|
80
91
|
|
81
92
|
- Add an optional `alpha` parameter to all `#css` calls. Thanks to Luke
|
@@ -296,3 +307,4 @@ this release without warning.
|
|
296
307
|
[issue-30]: https://github.com/halostatue/color/issues/30
|
297
308
|
[pr-11]: https://github.com/halostatue/color/pull/11
|
298
309
|
[pr-8]: https://github.com/halostatue/color/pulls/8
|
310
|
+
[pr-36]: https://github.com/halostatue/color/pull/36
|
data/CONTRIBUTING.md
CHANGED
@@ -1,39 +1,53 @@
|
|
1
1
|
# Contributing
|
2
2
|
|
3
|
-
Contribution to color is encouraged
|
4
|
-
|
3
|
+
Contribution to color is encouraged: bug reports, feature requests, or code
|
4
|
+
contributions. There are a few DOs and DON'Ts that should be followed.
|
5
5
|
|
6
|
-
|
6
|
+
## DO
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
- Keep the coding style that already exists for any updated Ruby code (support
|
9
|
+
or otherwise). I use [Standard Ruby][standardrb] for linting and formatting.
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
- Use thoughtfully-named topic branches for contributions. Rebase your commits
|
12
|
+
into logical chunks as necessary.
|
13
13
|
|
14
|
-
|
14
|
+
- Use [quality commit messages][qcm].
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
- Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
|
17
|
+
`CHANGELOG.md` as a separate commit from your main change. (Follow the style
|
18
|
+
in the `CHANGELOG.md` and provide a link to your PR.)
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
- Add or update tests as appropriate for your change. The test suite is written
|
21
|
+
with [minitest][minitest].
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- Add or update documentation as appropriate for your change. The documentation
|
24
|
+
is RDoc; color does not use extensions that may be present in alternative
|
25
|
+
documentation generators.
|
26
26
|
|
27
|
-
|
27
|
+
## DO NOT
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
- Modify `VERSION` in `lib/color/version.rb`. When your patch is accepted and a
|
30
|
+
release is made, the version will be updated at that point.
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
gem itself).
|
32
|
+
- Modify `color.gemspec`; it is a generated file. (You _may_ use `rake gemspec`
|
33
|
+
to regenerate it if your change involves metadata related to gem itself).
|
35
34
|
|
36
|
-
|
35
|
+
- Modify the `Gemfile`.
|
36
|
+
|
37
|
+
## LLM-Generated Contribution Policy
|
38
|
+
|
39
|
+
Color is a library full of complex math and subtle decisions (some of them
|
40
|
+
possibly even wrong). It is extremely important that any issues or pull requests
|
41
|
+
be well understood by the submitter and that, especially for pull requests, the
|
42
|
+
developer can attest to the [Developer Certificate of Origin](licences/dco.txt)
|
43
|
+
for each pull request (see [LICENCE](LICENCE.md)).
|
44
|
+
|
45
|
+
If LLM assistance is used in writing pull requests, this must be documented in
|
46
|
+
the commit message and pull request. If there is evidence of LLM assistance
|
47
|
+
without such declaration, the pull request **will be declined**.
|
48
|
+
|
49
|
+
Any contribution (bug, feature request, or pull request) that uses unreviewed
|
50
|
+
LLM output will be rejected.
|
37
51
|
|
38
52
|
## Test Dependencies
|
39
53
|
|
data/CONTRIBUTORS.md
CHANGED
data/LICENCE.md
CHANGED
@@ -25,3 +25,23 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
25
25
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
26
26
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
27
27
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
|
29
|
+
## Developer Certificate of Origin
|
30
|
+
|
31
|
+
All contributors **must** certify they are willing and able to provide their
|
32
|
+
contributions under the terms of this project's licences with the certification
|
33
|
+
of the [Developer Certificate of Origin (Version 1.1)](licences/dco.txt).
|
34
|
+
|
35
|
+
Such certification is provided by ensuring that a `Signed-off-by`
|
36
|
+
[commit trailer][trailer] is present on every commit:
|
37
|
+
|
38
|
+
Signed-off-by: FirstName LastName <email@example.org>
|
39
|
+
|
40
|
+
The `Signed-off-by` trailer can be automatically added by git with the `-s` or
|
41
|
+
`--signoff` option on `git commit`:
|
42
|
+
|
43
|
+
```sh
|
44
|
+
git commit --signoff
|
45
|
+
```
|
46
|
+
|
47
|
+
[trailer]: https://git-scm.com/docs/git-interpret-trailers
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -29,7 +29,7 @@ hoe = Hoe.spec "color" do
|
|
29
29
|
}
|
30
30
|
|
31
31
|
extra_dev_deps << ["hoe", "~> 4.0"]
|
32
|
-
extra_dev_deps << ["hoe-halostatue", "~> 2.
|
32
|
+
extra_dev_deps << ["hoe-halostatue", "~> 2.1", ">= 2.1.1"]
|
33
33
|
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
34
34
|
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
35
35
|
extra_dev_deps << ["hoe-gemspec2", "~> 1.4"]
|
data/SECURITY.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# color Security
|
2
2
|
|
3
|
+
## LLM-Generated Security Report Policy
|
4
|
+
|
5
|
+
Absolutely no security reports will be accepted that have been generated by LLM
|
6
|
+
agents.
|
7
|
+
|
3
8
|
## Supported Versions
|
4
9
|
|
5
10
|
Security reports are accepted for the most recent major release and the previous
|
data/lib/color/rgb/colors.rb
CHANGED
@@ -1,162 +1,189 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "color"
|
4
|
-
|
5
3
|
class Color::RGB
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
__create_named_color(self, from_values(0x5f, 0x9e, 0xa0), :CadetBlue)
|
20
|
-
__create_named_color(self, from_values(0xff, 0x5e, 0xd0), :Carnation)
|
21
|
-
__create_named_color(self, from_values(0x8d, 0x00, 0x00), :Cayenne)
|
22
|
-
__create_named_color(self, from_values(0x7f, 0xff, 0x00), :Chartreuse)
|
23
|
-
__create_named_color(self, from_values(0xd2, 0x69, 0x1e), :Chocolate)
|
24
|
-
__create_named_color(self, from_values(0xff, 0x7f, 0x50), :Coral)
|
25
|
-
__create_named_color(self, from_values(0x64, 0x95, 0xed), :CornflowerBlue)
|
26
|
-
__create_named_color(self, from_values(0xff, 0xf8, 0xdc), :Cornsilk)
|
27
|
-
__create_named_color(self, from_values(0xdc, 0x14, 0x3c), :Crimson)
|
28
|
-
__create_named_color(self, from_values(0x00, 0xff, 0xff), :Cyan)
|
29
|
-
__create_named_color(self, from_values(0x00, 0x00, 0x8b), :DarkBlue)
|
30
|
-
__create_named_color(self, from_values(0x00, 0x8b, 0x8b), :DarkCyan)
|
31
|
-
__create_named_color(self, from_values(0xb8, 0x86, 0x0b), :DarkGoldenRod, :DarkGoldenrod)
|
32
|
-
__create_named_color(self, from_values(0xa9, 0xa9, 0xa9), :DarkGray, :DarkGrey)
|
33
|
-
__create_named_color(self, from_values(0x00, 0x64, 0x00), :DarkGreen)
|
34
|
-
__create_named_color(self, from_values(0xbd, 0xb7, 0x6b), :DarkKhaki)
|
35
|
-
__create_named_color(self, from_values(0x8b, 0x00, 0x8b), :DarkMagenta)
|
36
|
-
__create_named_color(self, from_values(0x55, 0x6b, 0x2f), :DarkOliveGreen, :DarkoliveGreen)
|
37
|
-
__create_named_color(self, from_values(0xff, 0x8c, 0x00), :DarkOrange, :Darkorange)
|
38
|
-
__create_named_color(self, from_values(0x99, 0x32, 0xcc), :DarkOrchid)
|
39
|
-
__create_named_color(self, from_values(0x8b, 0x00, 0x00), :DarkRed)
|
40
|
-
__create_named_color(self, from_values(0xe9, 0x96, 0x7a), :DarkSalmon, :Darksalmon)
|
41
|
-
__create_named_color(self, from_values(0x8f, 0xbc, 0x8f), :DarkSeaGreen)
|
42
|
-
__create_named_color(self, from_values(0x48, 0x3d, 0x8b), :DarkSlateBlue)
|
43
|
-
__create_named_color(self, from_values(0x2f, 0x4f, 0x4f), :DarkSlateGray, :DarkSlateGrey)
|
44
|
-
__create_named_color(self, from_values(0x00, 0xce, 0xd1), :DarkTurquoise)
|
45
|
-
__create_named_color(self, from_values(0x94, 0x00, 0xd3), :DarkViolet)
|
46
|
-
__create_named_color(self, from_values(0xff, 0x14, 0x93), :DeepPink)
|
47
|
-
__create_named_color(self, from_values(0x00, 0xbf, 0xff), :DeepSkyBlue)
|
48
|
-
__create_named_color(self, from_values(0x69, 0x69, 0x69), :DimGray, :DimGrey)
|
49
|
-
__create_named_color(self, from_values(0x1e, 0x90, 0xff), :DodgerBlue)
|
50
|
-
__create_named_color(self, from_values(0xd1, 0x92, 0x75), :Feldspar)
|
51
|
-
__create_named_color(self, from_values(0xb2, 0x22, 0x22), :FireBrick, :Firebrick)
|
52
|
-
__create_named_color(self, from_values(0xff, 0xfa, 0xf0), :FloralWhite)
|
53
|
-
__create_named_color(self, from_values(0x22, 0x8b, 0x22), :ForestGreen)
|
54
|
-
__create_named_color(self, from_values(0xff, 0x00, 0xff), :Fuchsia)
|
55
|
-
__create_named_color(self, from_values(0xdc, 0xdc, 0xdc), :Gainsboro)
|
56
|
-
__create_named_color(self, from_values(0xf8, 0xf8, 0xff), :GhostWhite)
|
57
|
-
__create_named_color(self, from_values(0xff, 0xd7, 0x00), :Gold)
|
58
|
-
__create_named_color(self, from_values(0xda, 0xa5, 0x20), :GoldenRod, :Goldenrod)
|
59
|
-
__create_named_color(self, from_values(0x80, 0x80, 0x80), :Gray, :Grey)
|
4
|
+
# :stopdoc:
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def __create_named_colors(mod, *colors)
|
8
|
+
@__by_hex ||= {}
|
9
|
+
@__by_name ||= {}
|
10
|
+
|
11
|
+
colors.each do |color|
|
12
|
+
color => {rgb:, names:}
|
13
|
+
|
14
|
+
raise ArgumentError, "Names cannot be empty" if names.nil? || names.empty?
|
15
|
+
|
16
|
+
used = names - mod.constants.map(&:to_sym)
|
60
17
|
|
61
|
-
|
18
|
+
if used.length < names.length
|
19
|
+
raise ArgumentError, "#{names.join(", ")} already defined in #{mod}"
|
20
|
+
end
|
62
21
|
|
63
|
-
|
64
|
-
|
65
|
-
|
22
|
+
rgb = rgb.with(names: Array(names).flatten.compact.map { _1.to_s.downcase }.sort.uniq)
|
23
|
+
names.each { mod.const_set(_1, rgb) }
|
24
|
+
rgb.names.each { @__by_name[_1] = @__by_name[_1.to_s] = rgb }
|
25
|
+
lower = rgb.name.downcase
|
26
|
+
|
27
|
+
@__by_name[lower] = @__by_name[lower.to_s] = rgb
|
28
|
+
@__by_hex[rgb.hex] = rgb
|
29
|
+
end
|
30
|
+
end
|
66
31
|
end
|
67
32
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
33
|
+
__create_named_colors(
|
34
|
+
self,
|
35
|
+
{rgb: from_values(0xf0, 0xf8, 0xff), names: [:AliceBlue]},
|
36
|
+
{rgb: from_values(0xfa, 0xeb, 0xd7), names: [:AntiqueWhite]},
|
37
|
+
{rgb: from_values(0x00, 0xff, 0xff), names: [:Aqua]},
|
38
|
+
{rgb: from_values(0x7f, 0xff, 0xd4), names: [:Aquamarine]},
|
39
|
+
{rgb: from_values(0xf0, 0xff, 0xff), names: [:Azure]},
|
40
|
+
{rgb: from_values(0xf5, 0xf5, 0xdc), names: [:Beige]},
|
41
|
+
{rgb: from_values(0xff, 0xe4, 0xc4), names: [:Bisque]},
|
42
|
+
{rgb: from_values(0x00, 0x00, 0x00), names: [:Black]},
|
43
|
+
{rgb: from_values(0xff, 0xeb, 0xcd), names: [:BlanchedAlmond]},
|
44
|
+
{rgb: from_values(0x00, 0x00, 0xff), names: [:Blue]},
|
45
|
+
{rgb: from_values(0x8a, 0x2b, 0xe2), names: [:BlueViolet]},
|
46
|
+
{rgb: from_values(0xa5, 0x2a, 0x2a), names: [:Brown]},
|
47
|
+
{rgb: from_values(0xde, 0xb8, 0x87), names: [:BurlyWood, :Burlywood]},
|
48
|
+
{rgb: from_values(0x5f, 0x9e, 0xa0), names: [:CadetBlue]},
|
49
|
+
{rgb: from_values(0xff, 0x5e, 0xd0), names: [:Carnation]},
|
50
|
+
{rgb: from_values(0x8d, 0x00, 0x00), names: [:Cayenne]},
|
51
|
+
{rgb: from_values(0x7f, 0xff, 0x00), names: [:Chartreuse]},
|
52
|
+
{rgb: from_values(0xd2, 0x69, 0x1e), names: [:Chocolate]},
|
53
|
+
{rgb: from_values(0xff, 0x7f, 0x50), names: [:Coral]},
|
54
|
+
{rgb: from_values(0x64, 0x95, 0xed), names: [:CornflowerBlue]},
|
55
|
+
{rgb: from_values(0xff, 0xf8, 0xdc), names: [:Cornsilk]},
|
56
|
+
{rgb: from_values(0xdc, 0x14, 0x3c), names: [:Crimson]},
|
57
|
+
{rgb: from_values(0x00, 0xff, 0xff), names: [:Cyan]},
|
58
|
+
{rgb: from_values(0x00, 0x00, 0x8b), names: [:DarkBlue]},
|
59
|
+
{rgb: from_values(0x00, 0x8b, 0x8b), names: [:DarkCyan]},
|
60
|
+
{rgb: from_values(0xb8, 0x86, 0x0b), names: [:DarkGoldenRod, :DarkGoldenrod]},
|
61
|
+
{rgb: from_values(0xa9, 0xa9, 0xa9), names: [:DarkGray, :DarkGrey]},
|
62
|
+
{rgb: from_values(0x00, 0x64, 0x00), names: [:DarkGreen]},
|
63
|
+
{rgb: from_values(0xbd, 0xb7, 0x6b), names: [:DarkKhaki]},
|
64
|
+
{rgb: from_values(0x8b, 0x00, 0x8b), names: [:DarkMagenta]},
|
65
|
+
{rgb: from_values(0x55, 0x6b, 0x2f), names: [:DarkOliveGreen, :DarkoliveGreen]},
|
66
|
+
{rgb: from_values(0xff, 0x8c, 0x00), names: [:DarkOrange, :Darkorange]},
|
67
|
+
{rgb: from_values(0x99, 0x32, 0xcc), names: [:DarkOrchid]},
|
68
|
+
{rgb: from_values(0x8b, 0x00, 0x00), names: [:DarkRed]},
|
69
|
+
{rgb: from_values(0xe9, 0x96, 0x7a), names: [:DarkSalmon, :Darksalmon]},
|
70
|
+
{rgb: from_values(0x8f, 0xbc, 0x8f), names: [:DarkSeaGreen]},
|
71
|
+
{rgb: from_values(0x48, 0x3d, 0x8b), names: [:DarkSlateBlue]},
|
72
|
+
{rgb: from_values(0x2f, 0x4f, 0x4f), names: [:DarkSlateGray, :DarkSlateGrey]},
|
73
|
+
{rgb: from_values(0x00, 0xce, 0xd1), names: [:DarkTurquoise]},
|
74
|
+
{rgb: from_values(0x94, 0x00, 0xd3), names: [:DarkViolet]},
|
75
|
+
{rgb: from_values(0xff, 0x14, 0x93), names: [:DeepPink]},
|
76
|
+
{rgb: from_values(0x00, 0xbf, 0xff), names: [:DeepSkyBlue]},
|
77
|
+
{rgb: from_values(0x69, 0x69, 0x69), names: [:DimGray, :DimGrey]},
|
78
|
+
{rgb: from_values(0x1e, 0x90, 0xff), names: [:DodgerBlue]},
|
79
|
+
{rgb: from_values(0xd1, 0x92, 0x75), names: [:Feldspar]},
|
80
|
+
{rgb: from_values(0xb2, 0x22, 0x22), names: [:FireBrick, :Firebrick]},
|
81
|
+
{rgb: from_values(0xff, 0xfa, 0xf0), names: [:FloralWhite]},
|
82
|
+
{rgb: from_values(0x22, 0x8b, 0x22), names: [:ForestGreen]},
|
83
|
+
{rgb: from_values(0xff, 0x00, 0xff), names: [:Fuchsia]},
|
84
|
+
{rgb: from_values(0xdc, 0xdc, 0xdc), names: [:Gainsboro]},
|
85
|
+
{rgb: from_values(0xf8, 0xf8, 0xff), names: [:GhostWhite]},
|
86
|
+
{rgb: from_values(0xff, 0xd7, 0x00), names: [:Gold]},
|
87
|
+
{rgb: from_values(0xda, 0xa5, 0x20), names: [:GoldenRod, :Goldenrod]},
|
88
|
+
{rgb: from_values(0x80, 0x80, 0x80), names: [:Gray, :Grey]},
|
89
|
+
{rgb: from_fraction(0.05, 0.05, 0.05), names: [:Gray05, :Gray5, :Grey05, :Grey5]},
|
90
|
+
*(10..95).step(5).map {
|
91
|
+
v = _1 / 100.0
|
92
|
+
{rgb: from_fraction(v, v, v), names: [:"Gray#{_1}", :"Grey#{_1}"]}
|
93
|
+
},
|
94
|
+
{rgb: from_values(0x00, 0x80, 0x00), names: [:Green]},
|
95
|
+
{rgb: from_values(0xad, 0xff, 0x2f), names: [:GreenYellow]},
|
96
|
+
{rgb: from_values(0xf0, 0xff, 0xf0), names: [:HoneyDew, :Honeydew]},
|
97
|
+
{rgb: from_values(0xff, 0x69, 0xb4), names: [:HotPink]},
|
98
|
+
{rgb: from_values(0xcd, 0x5c, 0x5c), names: [:IndianRed]},
|
99
|
+
{rgb: from_values(0x4b, 0x00, 0x82), names: [:Indigo]},
|
100
|
+
{rgb: from_values(0xff, 0xff, 0xf0), names: [:Ivory]},
|
101
|
+
{rgb: from_values(0xf0, 0xe6, 0x8c), names: [:Khaki]},
|
102
|
+
{rgb: from_values(0xe6, 0xe6, 0xfa), names: [:Lavender]},
|
103
|
+
{rgb: from_values(0xff, 0xf0, 0xf5), names: [:LavenderBlush]},
|
104
|
+
{rgb: from_values(0x7c, 0xfc, 0x00), names: [:LawnGreen]},
|
105
|
+
{rgb: from_values(0xff, 0xfa, 0xcd), names: [:LemonChiffon]},
|
106
|
+
{rgb: from_values(0xad, 0xd8, 0xe6), names: [:LightBlue]},
|
107
|
+
{rgb: from_values(0xf0, 0x80, 0x80), names: [:LightCoral]},
|
108
|
+
{rgb: from_values(0xe0, 0xff, 0xff), names: [:LightCyan]},
|
109
|
+
{rgb: from_values(0xfa, 0xfa, 0xd2), names: [:LightGoldenRodYellow, :LightGoldenrodYellow]},
|
110
|
+
{rgb: from_values(0xd3, 0xd3, 0xd3), names: [:LightGray, :LightGrey]},
|
111
|
+
{rgb: from_values(0x90, 0xee, 0x90), names: [:LightGreen]},
|
112
|
+
{rgb: from_values(0xff, 0xb6, 0xc1), names: [:LightPink]},
|
113
|
+
{rgb: from_values(0xff, 0xa0, 0x7a), names: [:LightSalmon, :Lightsalmon]},
|
114
|
+
{rgb: from_values(0x20, 0xb2, 0xaa), names: [:LightSeaGreen]},
|
115
|
+
{rgb: from_values(0x87, 0xce, 0xfa), names: [:LightSkyBlue]},
|
116
|
+
{rgb: from_values(0x84, 0x70, 0xff), names: [:LightSlateBlue]},
|
117
|
+
{rgb: from_values(0x77, 0x88, 0x99), names: [:LightSlateGray, :LightSlateGrey]},
|
118
|
+
{rgb: from_values(0xb0, 0xc4, 0xde), names: [:LightSteelBlue, :LightsteelBlue]},
|
119
|
+
{rgb: from_values(0xff, 0xff, 0xe0), names: [:LightYellow]},
|
120
|
+
{rgb: from_values(0x00, 0xff, 0x00), names: [:Lime]},
|
121
|
+
{rgb: from_values(0x32, 0xcd, 0x32), names: [:LimeGreen]},
|
122
|
+
{rgb: from_values(0xfa, 0xf0, 0xe6), names: [:Linen]},
|
123
|
+
{rgb: from_values(0xff, 0x00, 0xff), names: [:Magenta]},
|
124
|
+
{rgb: from_values(0x80, 0x00, 0x00), names: [:Maroon]},
|
125
|
+
{rgb: from_values(0x66, 0xcd, 0xaa), names: [:MediumAquaMarine, :MediumAquamarine]},
|
126
|
+
{rgb: from_values(0x00, 0x00, 0xcd), names: [:MediumBlue]},
|
127
|
+
{rgb: from_values(0xba, 0x55, 0xd3), names: [:MediumOrchid]},
|
128
|
+
{rgb: from_values(0x93, 0x70, 0xdb), names: [:MediumPurple]},
|
129
|
+
{rgb: from_values(0x3c, 0xb3, 0x71), names: [:MediumSeaGreen]},
|
130
|
+
{rgb: from_values(0x7b, 0x68, 0xee), names: [:MediumSlateBlue]},
|
131
|
+
{rgb: from_values(0x00, 0xfa, 0x9a), names: [:MediumSpringGreen]},
|
132
|
+
{rgb: from_values(0x48, 0xd1, 0xcc), names: [:MediumTurquoise]},
|
133
|
+
{rgb: from_values(0xc7, 0x15, 0x85), names: [:MediumVioletRed]},
|
134
|
+
{rgb: from_values(0x19, 0x19, 0x70), names: [:MidnightBlue]},
|
135
|
+
{rgb: from_values(0xf5, 0xff, 0xfa), names: [:MintCream]},
|
136
|
+
{rgb: from_values(0xff, 0xe4, 0xe1), names: [:MistyRose]},
|
137
|
+
{rgb: from_values(0xff, 0xe4, 0xb5), names: [:Moccasin]},
|
138
|
+
{rgb: from_values(0xff, 0xde, 0xad), names: [:NavajoWhite]},
|
139
|
+
{rgb: from_values(0x00, 0x00, 0x80), names: [:Navy]},
|
140
|
+
{rgb: from_values(0xfd, 0xf5, 0xe6), names: [:OldLace]},
|
141
|
+
{rgb: from_values(0x80, 0x80, 0x00), names: [:Olive]},
|
142
|
+
{rgb: from_values(0x6b, 0x8e, 0x23), names: [:OliveDrab, :Olivedrab]},
|
143
|
+
{rgb: from_values(0xff, 0xa5, 0x00), names: [:Orange]},
|
144
|
+
{rgb: from_values(0xff, 0x45, 0x00), names: [:OrangeRed]},
|
145
|
+
{rgb: from_values(0xda, 0x70, 0xd6), names: [:Orchid]},
|
146
|
+
{rgb: from_values(0xee, 0xe8, 0xaa), names: [:PaleGoldenRod, :PaleGoldenrod]},
|
147
|
+
{rgb: from_values(0x98, 0xfb, 0x98), names: [:PaleGreen]},
|
148
|
+
{rgb: from_values(0xaf, 0xee, 0xee), names: [:PaleTurquoise]},
|
149
|
+
{rgb: from_values(0xdb, 0x70, 0x93), names: [:PaleVioletRed]},
|
150
|
+
{rgb: from_values(0xff, 0xef, 0xd5), names: [:PapayaWhip]},
|
151
|
+
{rgb: from_values(0xff, 0xda, 0xb9), names: [:PeachPuff, :Peachpuff]},
|
152
|
+
{rgb: from_values(0xcd, 0x85, 0x3f), names: [:Peru]},
|
153
|
+
{rgb: from_values(0xff, 0xc0, 0xcb), names: [:Pink]},
|
154
|
+
{rgb: from_values(0xdd, 0xa0, 0xdd), names: [:Plum]},
|
155
|
+
{rgb: from_values(0xb0, 0xe0, 0xe6), names: [:PowderBlue]},
|
156
|
+
{rgb: from_values(0x80, 0x00, 0x80), names: [:Purple]},
|
157
|
+
{rgb: from_values(0x66, 0x33, 0x99), names: [:RebeccaPurple]},
|
158
|
+
{rgb: from_values(0xff, 0x00, 0x00), names: [:Red]},
|
159
|
+
{rgb: from_values(0xbc, 0x8f, 0x8f), names: [:RosyBrown]},
|
160
|
+
{rgb: from_values(0x41, 0x69, 0xe1), names: [:RoyalBlue]},
|
161
|
+
{rgb: from_values(0x8b, 0x45, 0x13), names: [:SaddleBrown]},
|
162
|
+
{rgb: from_values(0xfa, 0x80, 0x72), names: [:Salmon]},
|
163
|
+
{rgb: from_values(0xf4, 0xa4, 0x60), names: [:SandyBrown]},
|
164
|
+
{rgb: from_values(0x2e, 0x8b, 0x57), names: [:SeaGreen]},
|
165
|
+
{rgb: from_values(0xff, 0xf5, 0xee), names: [:SeaShell, :Seashell]},
|
166
|
+
{rgb: from_values(0xa0, 0x52, 0x2d), names: [:Sienna]},
|
167
|
+
{rgb: from_values(0xc0, 0xc0, 0xc0), names: [:Silver]},
|
168
|
+
{rgb: from_values(0x87, 0xce, 0xeb), names: [:SkyBlue]},
|
169
|
+
{rgb: from_values(0x6a, 0x5a, 0xcd), names: [:SlateBlue]},
|
170
|
+
{rgb: from_values(0x70, 0x80, 0x90), names: [:SlateGray, :SlateGrey]},
|
171
|
+
{rgb: from_values(0xff, 0xfa, 0xfa), names: [:Snow]},
|
172
|
+
{rgb: from_values(0x00, 0xff, 0x7f), names: [:SpringGreen]},
|
173
|
+
{rgb: from_values(0x46, 0x82, 0xb4), names: [:SteelBlue]},
|
174
|
+
{rgb: from_values(0xd2, 0xb4, 0x8c), names: [:Tan]},
|
175
|
+
{rgb: from_values(0x00, 0x80, 0x80), names: [:Teal]},
|
176
|
+
{rgb: from_values(0xd8, 0xbf, 0xd8), names: [:Thistle]},
|
177
|
+
{rgb: from_values(0xff, 0x63, 0x47), names: [:Tomato]},
|
178
|
+
{rgb: from_values(0x40, 0xe0, 0xd0), names: [:Turquoise]},
|
179
|
+
{rgb: from_values(0xee, 0x82, 0xee), names: [:Violet]},
|
180
|
+
{rgb: from_values(0xd0, 0x20, 0x90), names: [:VioletRed]},
|
181
|
+
{rgb: from_values(0xf5, 0xde, 0xb3), names: [:Wheat]},
|
182
|
+
{rgb: from_values(0xff, 0xff, 0xff), names: [:White]},
|
183
|
+
{rgb: from_values(0xf5, 0xf5, 0xf5), names: [:WhiteSmoke]},
|
184
|
+
{rgb: from_values(0xff, 0xff, 0x00), names: [:Yellow]},
|
185
|
+
{rgb: from_values(0x9a, 0xcd, 0x32), names: [:YellowGreen]}
|
186
|
+
)
|
160
187
|
|
161
188
|
# :stopdoc:
|
162
189
|
# This namespace contains some RGB metallic colors suggested by Jim
|
@@ -165,17 +192,26 @@ class Color::RGB
|
|
165
192
|
|
166
193
|
module Metallic; end
|
167
194
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
195
|
+
__create_named_colors(
|
196
|
+
Metallic,
|
197
|
+
{rgb: from_values(0x99, 0x99, 0x99), names: [:Aluminum]},
|
198
|
+
{rgb: from_values(0xd9, 0x87, 0x19), names: [:CoolCopper]},
|
199
|
+
{rgb: from_values(0xb8, 0x73, 0x33), names: [:Copper]},
|
200
|
+
{rgb: from_values(0x4c, 0x4c, 0x4c), names: [:Iron]},
|
201
|
+
{rgb: from_values(0x19, 0x19, 0x19), names: [:Lead]},
|
202
|
+
{rgb: from_values(0xb3, 0xb3, 0xb3), names: [:Magnesium]},
|
203
|
+
{rgb: from_values(0xe6, 0xe6, 0xe6), names: [:Mercury]},
|
204
|
+
{rgb: from_values(0x80, 0x80, 0x80), names: [:Nickel]},
|
205
|
+
{rgb: from_values(0x60, 0x00, 0x00), names: [:PolySilicon, :Poly]},
|
206
|
+
{rgb: from_values(0xcc, 0xcc, 0xcc), names: [:Silver]},
|
207
|
+
{rgb: from_values(0x66, 0x66, 0x66), names: [:Steel]},
|
208
|
+
{rgb: from_values(0x7f, 0x7f, 0x7f), names: [:Tin]},
|
209
|
+
{rgb: from_values(0x33, 0x33, 0x33), names: [:Tungsten]}
|
210
|
+
)
|
211
|
+
|
212
|
+
class << self
|
213
|
+
undef :__create_named_colors
|
214
|
+
end
|
215
|
+
|
216
|
+
# :startdoc:
|
181
217
|
end
|
data/lib/color/rgb.rb
CHANGED
@@ -638,6 +638,7 @@ class << Color::RGB
|
|
638
638
|
##
|
639
639
|
# Extract named or hex colors from the provided text.
|
640
640
|
def extract_colors(text, mode = :both)
|
641
|
+
require "color/rgb/colors"
|
641
642
|
text = text.downcase
|
642
643
|
regex = case mode
|
643
644
|
when :name
|
@@ -646,6 +647,8 @@ class << Color::RGB
|
|
646
647
|
Regexp.union(__by_hex.keys)
|
647
648
|
when :both
|
648
649
|
Regexp.union(__by_hex.keys + __by_name.keys)
|
650
|
+
else
|
651
|
+
raise ArgumentError, "Unknown mode #{mode}"
|
649
652
|
end
|
650
653
|
|
651
654
|
text.scan(regex).map { |match|
|
@@ -662,33 +665,16 @@ class << Color::RGB
|
|
662
665
|
|
663
666
|
private
|
664
667
|
|
665
|
-
##
|
666
|
-
def __create_named_color(mod, rgb, *names) # :nodoc:
|
667
|
-
used = names - mod.constants.map(&:to_sym)
|
668
|
-
|
669
|
-
if used.length < names.length
|
670
|
-
raise ArgumentError, "#{names.join(", ")} already defined in #{mod}"
|
671
|
-
end
|
672
|
-
|
673
|
-
rgb = rgb.with(names: Array(names).flatten.compact.map { _1.to_s.downcase }.sort.uniq)
|
674
|
-
|
675
|
-
names.each { mod.const_set(_1, rgb) }
|
676
|
-
|
677
|
-
rgb.names.each { __by_name[_1] = __by_name[_1.to_s] = rgb }
|
678
|
-
lower = rgb.name.downcase
|
679
|
-
|
680
|
-
__by_name[lower] = __by_name[lower.to_s] = rgb
|
681
|
-
__by_hex[rgb.hex] = rgb
|
682
|
-
end
|
683
|
-
|
684
668
|
##
|
685
669
|
def __by_hex # :nodoc:
|
686
|
-
|
670
|
+
require "color/rgb/colors"
|
671
|
+
@__by_hex
|
687
672
|
end
|
688
673
|
|
689
674
|
##
|
690
675
|
def __by_name # :nodoc:
|
691
|
-
|
676
|
+
require "color/rgb/colors"
|
677
|
+
@__by_name
|
692
678
|
end
|
693
679
|
|
694
680
|
##
|
data/lib/color/version.rb
CHANGED
data/licenses/dco.txt
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Developer Certificate of Origin
|
2
|
+
Version 1.1
|
3
|
+
|
4
|
+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
5
|
+
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
7
|
+
license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
|
10
|
+
Developer's Certificate of Origin 1.1
|
11
|
+
|
12
|
+
By making a contribution to this project, I certify that:
|
13
|
+
|
14
|
+
(a) The contribution was created in whole or in part by me and I
|
15
|
+
have the right to submit it under the open source license
|
16
|
+
indicated in the file; or
|
17
|
+
|
18
|
+
(b) The contribution is based upon previous work that, to the best
|
19
|
+
of my knowledge, is covered under an appropriate open source
|
20
|
+
license and I have the right under that license to submit that
|
21
|
+
work with modifications, whether created in whole or in part
|
22
|
+
by me, under the same open source license (unless I am
|
23
|
+
permitted to submit under a different license), as indicated
|
24
|
+
in the file; or
|
25
|
+
|
26
|
+
(c) The contribution was provided directly to me by some other
|
27
|
+
person who certified (a), (b) or (c) and I have not modified
|
28
|
+
it.
|
29
|
+
|
30
|
+
(d) I understand and agree that this project and the contribution
|
31
|
+
are public and that a record of the contribution (including all
|
32
|
+
personal information I submit with it, including my sign-off) is
|
33
|
+
maintained indefinitely and may be redistributed consistent with
|
34
|
+
this project or the open source license(s) involved.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: color
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.
|
4
|
+
version: 2.0.0.pre.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
@@ -30,14 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.1'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.1.1
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
43
|
+
version: '2.1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.1.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: hoe-doofus
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,6 +255,7 @@ extra_rdoc_files:
|
|
249
255
|
- Manifest.txt
|
250
256
|
- README.md
|
251
257
|
- SECURITY.md
|
258
|
+
- licenses/dco.txt
|
252
259
|
files:
|
253
260
|
- CHANGELOG.md
|
254
261
|
- CODE_OF_CONDUCT.md
|
@@ -269,6 +276,7 @@ files:
|
|
269
276
|
- lib/color/version.rb
|
270
277
|
- lib/color/xyz.rb
|
271
278
|
- lib/color/yiq.rb
|
279
|
+
- licenses/dco.txt
|
272
280
|
- test/fixtures/cielab.json
|
273
281
|
- test/minitest_helper.rb
|
274
282
|
- test/test_cmyk.rb
|