color 2.0.0.pre.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d67585f5f81335c4e8f679912c4600f5cd183bcfe6072bc40c458a8d825fde4
4
- data.tar.gz: 0b6a1c7c6b090805d8df447e3e5e86940d1e07b12e3400d90d1ae0c523f37ab6
3
+ metadata.gz: 331a961b44a39f14962462ee51a7350873b2a1fb87ffebcad1b84e9f7334e3a9
4
+ data.tar.gz: b429071184007e7d4b30d3940005421715c4743dd568b4c0bb24f49b8224693e
5
5
  SHA512:
6
- metadata.gz: aea11ce9923c90da5ac785fa0d314eb3dce2c4aacd919e5a522d5f0ee1d6b6ef2158890985d8a0c32b7db596a9043529a1f3c94ba70d9489f07c28f18e8a50a2
7
- data.tar.gz: 5613ee60327f1ec52a56275fdf8af4d0a39b46dcfbecdb69a5e1f7b6037cc8e029228445410cb310ee85784e5574b58d9715f4c0bf76c87fc31c7b90eaf21bae
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.1 / 2025-06-16
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
 
@@ -79,6 +79,14 @@ this release without warning.
79
79
  automated releases are enabled), full GitHub Actions, Dependabot, Standard
80
80
  Ruby, and more.
81
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
+
82
90
  ## 1.8 / 2015-10-26
83
91
 
84
92
  - Add an optional `alpha` parameter to all `#css` calls. Thanks to Luke
@@ -299,3 +307,4 @@ this release without warning.
299
307
  [issue-30]: https://github.com/halostatue/color/issues/30
300
308
  [pr-11]: https://github.com/halostatue/color/pull/11
301
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 in any form: a bug report, a feature
4
- request, or code contributions. There are a few DOs and DON'Ts for
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
- - DO:
6
+ ## DO
7
7
 
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.
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
- - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
- into logical chunks as necessary.
11
+ - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
+ into logical chunks as necessary.
13
13
 
14
- - Use [quality commit messages][qcm].
14
+ - Use [quality commit messages][qcm].
15
15
 
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.)
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
- - Add or update tests as appropriate for your change. The test suite is
21
- written with [minitest][minitest].
20
+ - Add or update tests as appropriate for your change. The test suite is written
21
+ with [minitest][minitest].
22
22
 
23
- - Add or update documentation as appropriate for your change. The
24
- documentation is RDoc; color does not use extensions that may be present in
25
- alternative documentation generators.
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
- - DO NOT:
27
+ ## DO NOT
28
28
 
29
- - Modify `VERSION` in `lib/color/version.rb`. When your patch is accepted and
30
- a release is made, the version will be updated at that point.
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
- - Modify `color.gemspec`; it is a generated file. (You _may_ use
33
- `rake gemspec` to regenerate it if your change involves metadata related to
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
- - Modify the `Gemfile`.
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
@@ -8,3 +8,4 @@
8
8
  - Luke Bennellick
9
9
  - @stiff (CIELAB color support)
10
10
  - Matthew Draper
11
+ - Charles Nutter
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
@@ -17,6 +17,7 @@ lib/color/rgb/colors.rb
17
17
  lib/color/version.rb
18
18
  lib/color/xyz.rb
19
19
  lib/color/yiq.rb
20
+ licenses/dco.txt
20
21
  test/fixtures/cielab.json
21
22
  test/minitest_helper.rb
22
23
  test/test_cmyk.rb
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.0"]
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
@@ -1,162 +1,189 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "color"
4
-
5
3
  class Color::RGB
6
- __create_named_color(self, from_values(0xf0, 0xf8, 0xff), :AliceBlue)
7
- __create_named_color(self, from_values(0xfa, 0xeb, 0xd7), :AntiqueWhite)
8
- __create_named_color(self, from_values(0x00, 0xff, 0xff), :Aqua)
9
- __create_named_color(self, from_values(0x7f, 0xff, 0xd4), :Aquamarine)
10
- __create_named_color(self, from_values(0xf0, 0xff, 0xff), :Azure)
11
- __create_named_color(self, from_values(0xf5, 0xf5, 0xdc), :Beige)
12
- __create_named_color(self, from_values(0xff, 0xe4, 0xc4), :Bisque)
13
- __create_named_color(self, from_values(0x00, 0x00, 0x00), :Black)
14
- __create_named_color(self, from_values(0xff, 0xeb, 0xcd), :BlanchedAlmond)
15
- __create_named_color(self, from_values(0x00, 0x00, 0xff), :Blue)
16
- __create_named_color(self, from_values(0x8a, 0x2b, 0xe2), :BlueViolet)
17
- __create_named_color(self, from_values(0xa5, 0x2a, 0x2a), :Brown)
18
- __create_named_color(self, from_values(0xde, 0xb8, 0x87), :BurlyWood, :Burlywood)
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
- __create_named_color(self, from_fraction(0.05, 0.05, 0.05), :Gray05, :Gray5, :Grey05, :Grey5)
18
+ if used.length < names.length
19
+ raise ArgumentError, "#{names.join(", ")} already defined in #{mod}"
20
+ end
62
21
 
63
- (10..95).step(5) do
64
- v = _1 / 100.0
65
- __create_named_color(self, from_fraction(v, v, v), :"Gray#{_1}", :"Grey#{_1}")
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
- __create_named_color(self, from_values(0x00, 0x80, 0x00), :Green)
69
- __create_named_color(self, from_values(0xad, 0xff, 0x2f), :GreenYellow)
70
- __create_named_color(self, from_values(0xf0, 0xff, 0xf0), :HoneyDew, :Honeydew)
71
- __create_named_color(self, from_values(0xff, 0x69, 0xb4), :HotPink)
72
- __create_named_color(self, from_values(0xcd, 0x5c, 0x5c), :IndianRed)
73
- __create_named_color(self, from_values(0x4b, 0x00, 0x82), :Indigo)
74
- __create_named_color(self, from_values(0xff, 0xff, 0xf0), :Ivory)
75
- __create_named_color(self, from_values(0xf0, 0xe6, 0x8c), :Khaki)
76
- __create_named_color(self, from_values(0xe6, 0xe6, 0xfa), :Lavender)
77
- __create_named_color(self, from_values(0xff, 0xf0, 0xf5), :LavenderBlush)
78
- __create_named_color(self, from_values(0x7c, 0xfc, 0x00), :LawnGreen)
79
- __create_named_color(self, from_values(0xff, 0xfa, 0xcd), :LemonChiffon)
80
- __create_named_color(self, from_values(0xad, 0xd8, 0xe6), :LightBlue)
81
- __create_named_color(self, from_values(0xf0, 0x80, 0x80), :LightCoral)
82
- __create_named_color(self, from_values(0xe0, 0xff, 0xff), :LightCyan)
83
- __create_named_color(self, from_values(0xfa, 0xfa, 0xd2), :LightGoldenRodYellow, :LightGoldenrodYellow)
84
- __create_named_color(self, from_values(0xd3, 0xd3, 0xd3), :LightGray, :LightGrey)
85
- __create_named_color(self, from_values(0x90, 0xee, 0x90), :LightGreen)
86
- __create_named_color(self, from_values(0xff, 0xb6, 0xc1), :LightPink)
87
- __create_named_color(self, from_values(0xff, 0xa0, 0x7a), :LightSalmon, :Lightsalmon)
88
- __create_named_color(self, from_values(0x20, 0xb2, 0xaa), :LightSeaGreen)
89
- __create_named_color(self, from_values(0x87, 0xce, 0xfa), :LightSkyBlue)
90
- __create_named_color(self, from_values(0x84, 0x70, 0xff), :LightSlateBlue)
91
- __create_named_color(self, from_values(0x77, 0x88, 0x99), :LightSlateGray, :LightSlateGrey)
92
- __create_named_color(self, from_values(0xb0, 0xc4, 0xde), :LightSteelBlue, :LightsteelBlue)
93
- __create_named_color(self, from_values(0xff, 0xff, 0xe0), :LightYellow)
94
- __create_named_color(self, from_values(0x00, 0xff, 0x00), :Lime)
95
- __create_named_color(self, from_values(0x32, 0xcd, 0x32), :LimeGreen)
96
- __create_named_color(self, from_values(0xfa, 0xf0, 0xe6), :Linen)
97
- __create_named_color(self, from_values(0xff, 0x00, 0xff), :Magenta)
98
- __create_named_color(self, from_values(0x80, 0x00, 0x00), :Maroon)
99
- __create_named_color(self, from_values(0x66, 0xcd, 0xaa), :MediumAquaMarine, :MediumAquamarine)
100
- __create_named_color(self, from_values(0x00, 0x00, 0xcd), :MediumBlue)
101
- __create_named_color(self, from_values(0xba, 0x55, 0xd3), :MediumOrchid)
102
- __create_named_color(self, from_values(0x93, 0x70, 0xdb), :MediumPurple)
103
- __create_named_color(self, from_values(0x3c, 0xb3, 0x71), :MediumSeaGreen)
104
- __create_named_color(self, from_values(0x7b, 0x68, 0xee), :MediumSlateBlue)
105
- __create_named_color(self, from_values(0x00, 0xfa, 0x9a), :MediumSpringGreen)
106
- __create_named_color(self, from_values(0x48, 0xd1, 0xcc), :MediumTurquoise)
107
- __create_named_color(self, from_values(0xc7, 0x15, 0x85), :MediumVioletRed)
108
- __create_named_color(self, from_values(0x19, 0x19, 0x70), :MidnightBlue)
109
- __create_named_color(self, from_values(0xf5, 0xff, 0xfa), :MintCream)
110
- __create_named_color(self, from_values(0xff, 0xe4, 0xe1), :MistyRose)
111
- __create_named_color(self, from_values(0xff, 0xe4, 0xb5), :Moccasin)
112
- __create_named_color(self, from_values(0xff, 0xde, 0xad), :NavajoWhite)
113
- __create_named_color(self, from_values(0x00, 0x00, 0x80), :Navy)
114
- __create_named_color(self, from_values(0xfd, 0xf5, 0xe6), :OldLace)
115
- __create_named_color(self, from_values(0x80, 0x80, 0x00), :Olive)
116
- __create_named_color(self, from_values(0x6b, 0x8e, 0x23), :OliveDrab, :Olivedrab)
117
- __create_named_color(self, from_values(0xff, 0xa5, 0x00), :Orange)
118
- __create_named_color(self, from_values(0xff, 0x45, 0x00), :OrangeRed)
119
- __create_named_color(self, from_values(0xda, 0x70, 0xd6), :Orchid)
120
- __create_named_color(self, from_values(0xee, 0xe8, 0xaa), :PaleGoldenRod, :PaleGoldenrod)
121
- __create_named_color(self, from_values(0x98, 0xfb, 0x98), :PaleGreen)
122
- __create_named_color(self, from_values(0xaf, 0xee, 0xee), :PaleTurquoise)
123
- __create_named_color(self, from_values(0xdb, 0x70, 0x93), :PaleVioletRed)
124
- __create_named_color(self, from_values(0xff, 0xef, 0xd5), :PapayaWhip)
125
- __create_named_color(self, from_values(0xff, 0xda, 0xb9), :PeachPuff, :Peachpuff)
126
- __create_named_color(self, from_values(0xcd, 0x85, 0x3f), :Peru)
127
- __create_named_color(self, from_values(0xff, 0xc0, 0xcb), :Pink)
128
- __create_named_color(self, from_values(0xdd, 0xa0, 0xdd), :Plum)
129
- __create_named_color(self, from_values(0xb0, 0xe0, 0xe6), :PowderBlue)
130
- __create_named_color(self, from_values(0x80, 0x00, 0x80), :Purple)
131
- __create_named_color(self, from_values(0x66, 0x33, 0x99), :RebeccaPurple)
132
- __create_named_color(self, from_values(0xff, 0x00, 0x00), :Red)
133
- __create_named_color(self, from_values(0xbc, 0x8f, 0x8f), :RosyBrown)
134
- __create_named_color(self, from_values(0x41, 0x69, 0xe1), :RoyalBlue)
135
- __create_named_color(self, from_values(0x8b, 0x45, 0x13), :SaddleBrown)
136
- __create_named_color(self, from_values(0xfa, 0x80, 0x72), :Salmon)
137
- __create_named_color(self, from_values(0xf4, 0xa4, 0x60), :SandyBrown)
138
- __create_named_color(self, from_values(0x2e, 0x8b, 0x57), :SeaGreen)
139
- __create_named_color(self, from_values(0xff, 0xf5, 0xee), :SeaShell, :Seashell)
140
- __create_named_color(self, from_values(0xa0, 0x52, 0x2d), :Sienna)
141
- __create_named_color(self, from_values(0xc0, 0xc0, 0xc0), :Silver)
142
- __create_named_color(self, from_values(0x87, 0xce, 0xeb), :SkyBlue)
143
- __create_named_color(self, from_values(0x6a, 0x5a, 0xcd), :SlateBlue)
144
- __create_named_color(self, from_values(0x70, 0x80, 0x90), :SlateGray, :SlateGrey)
145
- __create_named_color(self, from_values(0xff, 0xfa, 0xfa), :Snow)
146
- __create_named_color(self, from_values(0x00, 0xff, 0x7f), :SpringGreen)
147
- __create_named_color(self, from_values(0x46, 0x82, 0xb4), :SteelBlue)
148
- __create_named_color(self, from_values(0xd2, 0xb4, 0x8c), :Tan)
149
- __create_named_color(self, from_values(0x00, 0x80, 0x80), :Teal)
150
- __create_named_color(self, from_values(0xd8, 0xbf, 0xd8), :Thistle)
151
- __create_named_color(self, from_values(0xff, 0x63, 0x47), :Tomato)
152
- __create_named_color(self, from_values(0x40, 0xe0, 0xd0), :Turquoise)
153
- __create_named_color(self, from_values(0xee, 0x82, 0xee), :Violet)
154
- __create_named_color(self, from_values(0xd0, 0x20, 0x90), :VioletRed)
155
- __create_named_color(self, from_values(0xf5, 0xde, 0xb3), :Wheat)
156
- __create_named_color(self, from_values(0xff, 0xff, 0xff), :White)
157
- __create_named_color(self, from_values(0xf5, 0xf5, 0xf5), :WhiteSmoke)
158
- __create_named_color(self, from_values(0xff, 0xff, 0x00), :Yellow)
159
- __create_named_color(self, from_values(0x9a, 0xcd, 0x32), :YellowGreen)
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
- __create_named_color(Metallic, from_values(0x99, 0x99, 0x99), :Aluminum)
169
- __create_named_color(Metallic, from_values(0xd9, 0x87, 0x19), :CoolCopper)
170
- __create_named_color(Metallic, from_values(0xb8, 0x73, 0x33), :Copper)
171
- __create_named_color(Metallic, from_values(0x4c, 0x4c, 0x4c), :Iron)
172
- __create_named_color(Metallic, from_values(0x19, 0x19, 0x19), :Lead)
173
- __create_named_color(Metallic, from_values(0xb3, 0xb3, 0xb3), :Magnesium)
174
- __create_named_color(Metallic, from_values(0xe6, 0xe6, 0xe6), :Mercury)
175
- __create_named_color(Metallic, from_values(0x80, 0x80, 0x80), :Nickel)
176
- __create_named_color(Metallic, from_values(0x60, 0x00, 0x00), :PolySilicon, :Poly)
177
- __create_named_color(Metallic, from_values(0xcc, 0xcc, 0xcc), :Silver)
178
- __create_named_color(Metallic, from_values(0x66, 0x66, 0x66), :Steel)
179
- __create_named_color(Metallic, from_values(0x7f, 0x7f, 0x7f), :Tin)
180
- __create_named_color(Metallic, from_values(0x33, 0x33, 0x33), :Tungsten)
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
@@ -665,35 +665,16 @@ class << Color::RGB
665
665
 
666
666
  private
667
667
 
668
- ##
669
- def __create_named_color(mod, rgb, *names) # :nodoc:
670
- used = names - mod.constants.map(&:to_sym)
671
-
672
- if used.length < names.length
673
- raise ArgumentError, "#{names.join(", ")} already defined in #{mod}"
674
- end
675
-
676
- rgb = rgb.with(names: Array(names).flatten.compact.map { _1.to_s.downcase }.sort.uniq)
677
-
678
- names.each { mod.const_set(_1, rgb) }
679
-
680
- rgb.names.each { __by_name[_1] = __by_name[_1.to_s] = rgb }
681
- lower = rgb.name.downcase
682
-
683
- __by_name[lower] = __by_name[lower.to_s] = rgb
684
- __by_hex[rgb.hex] = rgb
685
- end
686
-
687
668
  ##
688
669
  def __by_hex # :nodoc:
689
670
  require "color/rgb/colors"
690
- @__by_hex ||= {}
671
+ @__by_hex
691
672
  end
692
673
 
693
674
  ##
694
675
  def __by_name # :nodoc:
695
676
  require "color/rgb/colors"
696
- @__by_name ||= {}
677
+ @__by_name
697
678
  end
698
679
 
699
680
  ##
data/lib/color/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Color
4
- VERSION = "2.0.0.pre.1" # :nodoc:
4
+ VERSION = "2.0.0.pre.2" # :nodoc:
5
5
  end
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.1
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.0'
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.0'
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