color 1.8 → 2.0.1

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.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +314 -0
  3. data/CODE_OF_CONDUCT.md +128 -0
  4. data/CONTRIBUTING.md +84 -0
  5. data/CONTRIBUTORS.md +11 -0
  6. data/LICENCE.md +50 -0
  7. data/Manifest.txt +12 -23
  8. data/README.md +54 -0
  9. data/Rakefile +72 -61
  10. data/SECURITY.md +39 -0
  11. data/lib/color/cielab.rb +348 -0
  12. data/lib/color/cmyk.rb +279 -213
  13. data/lib/color/grayscale.rb +128 -160
  14. data/lib/color/hsl.rb +205 -173
  15. data/lib/color/rgb/colors.rb +211 -161
  16. data/lib/color/rgb.rb +527 -551
  17. data/lib/color/version.rb +5 -0
  18. data/lib/color/xyz.rb +214 -0
  19. data/lib/color/yiq.rb +91 -46
  20. data/lib/color.rb +204 -142
  21. data/licences/dco.txt +34 -0
  22. data/test/fixtures/cielab.json +444 -0
  23. data/test/minitest_helper.rb +20 -4
  24. data/test/test_cmyk.rb +49 -72
  25. data/test/test_color.rb +58 -112
  26. data/test/test_grayscale.rb +35 -57
  27. data/test/test_hsl.rb +71 -77
  28. data/test/test_rgb.rb +195 -267
  29. data/test/test_yiq.rb +12 -30
  30. metadata +104 -121
  31. data/.autotest +0 -5
  32. data/.coveralls.yml +0 -2
  33. data/.gemtest +0 -0
  34. data/.hoerc +0 -2
  35. data/.minitest.rb +0 -2
  36. data/.travis.yml +0 -41
  37. data/Code-of-Conduct.rdoc +0 -41
  38. data/Contributing.rdoc +0 -62
  39. data/Gemfile +0 -9
  40. data/History.rdoc +0 -194
  41. data/Licence.rdoc +0 -27
  42. data/README.rdoc +0 -52
  43. data/lib/color/css.rb +0 -7
  44. data/lib/color/palette/adobecolor.rb +0 -260
  45. data/lib/color/palette/gimp.rb +0 -104
  46. data/lib/color/palette/monocontrast.rb +0 -164
  47. data/lib/color/palette.rb +0 -4
  48. data/lib/color/rgb/contrast.rb +0 -57
  49. data/lib/color/rgb/metallic.rb +0 -28
  50. data/test/test_adobecolor.rb +0 -405
  51. data/test/test_css.rb +0 -19
  52. data/test/test_gimp.rb +0 -87
  53. data/test/test_monocontrast.rb +0 -130
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 696c2ac0e8282a88cbe1626c779ad336b679f5a1
4
- data.tar.gz: c9b3d3786799d258a32120f1560ed16c29a40f7f
2
+ SHA256:
3
+ metadata.gz: de0f595f559249d4eed1b1a71514d9b31caf458544b10d791b954b68d42ae169
4
+ data.tar.gz: 1d6680d9805b0556a7b865b5bf9bced7b089ed72c8889a7187ac30a082826efb
5
5
  SHA512:
6
- metadata.gz: b78ecb062c1ddcc02a98d6b5aad1e060f0f1276dfd82f3f28f2f7c572659dcf98ef9853d519607fee8c44623de006604e6028dfe43d6ab765dc362a346c69978
7
- data.tar.gz: f08e750ae6fbb4ac464f6de6657f30bab8e7866fe072aa948c828da8e5881305eaaa254d7e88ca7d2b60fa2aa569fa616a51f836fe4d7f131306493a4a7962ae
6
+ metadata.gz: 6bb3c94216b72f936f2252de8b698ff28e8fbc240bee72fa5cd4d016f3a911de3755b8ba892cbe857a8f3f4a9aeaef4bd79132e14c4230eff2f047690a8940d2
7
+ data.tar.gz: 275c0cdaed2c2474eedc59a915910dca1573a95f35f7cf41a5758f60284dbb3402454b56c17fb0d833de0b57047dddde25df09f2211585fe5957be68ee1791f2
data/CHANGELOG.md ADDED
@@ -0,0 +1,314 @@
1
+ # Changelog
2
+
3
+ ## 2.0.1 / 2025-07-05
4
+
5
+ Color 2.0.1 is a minor documentation update.
6
+
7
+ ## 2.0.0 / 2025-07-05
8
+
9
+ Color 2.0.0 is a major release of the Color library.
10
+
11
+ ### 💣 Breaking Changes
12
+
13
+ Color 2.0 contains breaking changes. Functionality previously deprecated has
14
+ been removed, but other functionality has been changed or removed as part of
15
+ this release without prior warning.
16
+
17
+ - The minimum supported version of Ruby is 3.2.
18
+
19
+ - Color classes are now immutable implementations of Data objects (first
20
+ introduced in Ruby 3.2). This will restrict Color 2 from running on versions
21
+ of JRuby before JRuby 10.
22
+
23
+ - The constants `Color::COLOR_VERSION` and `Color::COLOR_TOOLS_VERSION` have
24
+ been removed; there is only `Color::VERSION`. This reverses a planned
25
+ deprecation decision made more than ten years ago that no longer makes sense.
26
+
27
+ - All named color classes at `Color` have been removed as planned.
28
+
29
+ - `Color::RGB::BeccaPurple` has been removed as an alias for
30
+ `Color::RGB::RebeccaPurple`.
31
+
32
+ - The pseudo-constructor `Color.new` has been removed.
33
+
34
+ - Color class constructors no longer yield the constructed color if a block is
35
+ passed.
36
+
37
+ - Renamed `Color::COLOR_EPSILON` and `Color::COLOR_TOLERANCE` to
38
+ `Color::EPSILON` and `Color::TOLERANCE`. These aren't private constants
39
+ because they need to be accessed throughout Color, but they are _internal_
40
+ constants that should not be used outside of the Color library or functions
41
+ exposed therein.
42
+
43
+ - PDF format functions `#pdf_fill` and `#pdf_stroke` have been removed from
44
+ `Color::CMYK`, `Color::Grayscale`, and `Color::RGB`. The supporting internal
45
+ constants `Color::<class>::PDF_FORMAT_STR` have also been removed.
46
+
47
+ - Palette processing classes, `Color::Palette::AdobeColor`,
48
+ `Color::Palette::Gimp`, and `Color::Palette::MonoContrast` have been removed.
49
+ Persons interested in using these are encouraged to extract them from
50
+ [Color 1.8][color-1.8] and adapt them to use Color 2.0 APIs.
51
+
52
+ - CSS methods (`#css_rgb`, `#css_rgba`, `#css_hsl`, `#css_hsla`) have been
53
+ replaced with `#css` on color classes that have CSS representations. The
54
+ output of `#css` differs (Color 1.8 used the legacy CSS color formats; Color
55
+ 2.0 uses modern CSS color formats).
56
+
57
+ - `Color::GrayScale` has been renamed to `Color::Grayscale`. The alias constant
58
+ `Color::GreyScale` has been removed.
59
+
60
+ - The `#html` method has been removed from all color classes except Color::RGB.
61
+
62
+ - Named RGB colors are no longer defined automatically, but must be loaded
63
+ explicitly by requiring `color/rgb/colors`. This resolves [#30][issue-30]. The
64
+ use of `Color::RGB#extract_colors`, `Color::RGB.by_hex`, `Color::RGB.by_name`,
65
+ or `Color::RGB.by_css` will require `color/rgb/colors` automatically as they
66
+ require the presence of the named colors.
67
+
68
+ - `Color:CSS#[]` has been removed, as has the containing namespace. It has
69
+ always been a shallow wrapper around `Color::RGB.by_name`.
70
+
71
+ ### 🚀 New Features
72
+
73
+ - `Color::CIELAB` and `Color::XYZ` namespaces have been added. Separate
74
+ implementations were submitted by David Heitzman and @stiff (in [#8][pr-8] and
75
+ [#11][pr-11]), but I have reworked the code substantially. These
76
+ implementations were originally as `Color::LAB` and include a new contrast
77
+ calculation using the ΔE\*00 algorithm.
78
+
79
+ ### Internal
80
+
81
+ - Updated project structure for how I manage Ruby libraries in 2025. This
82
+ includes increased release security (MFA is required for all releases,
83
+ automated releases are enabled), full GitHub Actions, Dependabot, Standard
84
+ Ruby, and more.
85
+
86
+ - Charles Nutter re-added JRuby support in CI. [#36][pr-36]
87
+
88
+ ### Governance
89
+
90
+ Color 2.0 and later requires that all contributions be signed-off attesting that
91
+ the developer created the change and has the appropriate permissions or
92
+ ownership to contribute it to this project under the licence terms.
93
+
94
+ ## 1.8 / 2015-10-26
95
+
96
+ - Add an optional `alpha` parameter to all `#css` calls. Thanks to Luke
97
+ Bennellick (@bennell) and Alexander Popov (@AlexWayfer) for independently
98
+ implemented submissions. Merged from [#15][pull-15].
99
+
100
+ - Improve constant detection to prevent incorrectly identified name collisions
101
+ with various other libraries such as Azure deployment tools. Based on work by
102
+ Matthew Draper (@matthewd) in [#24][pull-24].
103
+
104
+ - Prevent `Color.equivalent?` comparisons from using non-Color types for
105
+ comparison. Fix provided by Benjamin Guest (@bguest) in [#18][pull-18].
106
+
107
+ - This project now has a [Code of Conduct](CODE_OF_CONDUCT.md).
108
+
109
+ ## 1.7.1 / 2014-06-12
110
+
111
+ - Renamed `Color::RGB::BeccaPurple` to `Color::RGB::RebeccaPurple` as stipulated
112
+ by Eric Meyer. For purposes of backwards compatibility, the previous name is
113
+ still permitted, but its use is strongly discouraged, and it will be removed
114
+ in the Color 2.0 release.
115
+ <http://meyerweb.com/eric/thoughts/2014/06/19/rebeccapurple/>
116
+
117
+ ## 1.7 / 2014-06-12
118
+
119
+ - Added `Color::RGB::BeccaPurple` (#663399) in honour of Rebecca Meyer, the
120
+ daughter of Eric Meyer, who passed away on the 7 June 2014. Her favourite
121
+ color was purple. `#663399becca`
122
+ <https://twitter.com/meyerweb/status/476089708674428929>
123
+ <http://www.zeldman.com/2014/06/10/the-color-purple/>
124
+ <http://discourse.specifiction.org/t/name-663399-becca-purple-in-css4-color/225>
125
+
126
+ - Changed the homepage in the gem to point to GitHub instead of RubyForge, which
127
+ has been shut down. Fixes [#10][issue-10], reported by @voxik.
128
+
129
+ ## 1.6 / 2014-05-19
130
+
131
+ - Aaron Hill (@armahillo) implemented the CIE Delta E 94 method by which an RGB
132
+ color can be asked for the closest matching color from a list of provided
133
+ colors. Fixes [#5][issue-5].
134
+
135
+ - To implement `#closest_match` and `#delta_e94`, conversion methods for sRGB to
136
+ XYZ and XYZ to L\*a\*b\* space were implemented. These should be considered
137
+ experimental.
138
+
139
+ - Ensured that the gem manifest was up-to-date. Fixes [#4][issue-4] reported by
140
+ @boutil. Thanks!
141
+
142
+ - Fixed problems with Travis builds. Note that Ruby 1.9.2 is no longer tested.
143
+ Rubinius remains in a 'failure-tolerated' mode.
144
+
145
+ - Color 1.6 is, barring security patches, the last release of Color that will
146
+ support Ruby 1.8.
147
+
148
+ ## 1.5.1 / 2014-01-28
149
+
150
+ - color 1.5 was a yanked release.
151
+
152
+ - Added new methods to `Color::RGB` to make it so that the default defined
153
+ colors can be looked up by hex, name, or both.
154
+
155
+ - Added a method to `Color::RGB` to extract colors from text by hex, name, or
156
+ both.
157
+
158
+ - Added new common methods for color names. Converted colors do not retain
159
+ names.
160
+
161
+ - Restructured color comparisons to use protocols instead of custom
162
+ implementations. This makes it easier to implement new color classes. To make
163
+ this work, color classes should `include` Color only need to implement
164
+ `#coerce(other)`, `#to_a`, and supported conversion methods (e.g., `#to_rgb`).
165
+
166
+ - Added @daveheitzman's initial implementation of a RGB contrast method as an
167
+ extension file: `require 'color/rgb/contrast'`. This method and the value it
168
+ returns should be considered experimental; it requires further examination to
169
+ ensure that the results produced are consistent with the contrast comparisons
170
+ used in `Color::Palette::MonoContrast`.
171
+
172
+ - Reducing duplicated code.
173
+
174
+ - Moved `lib/color/rgb-colors.rb` to `lib/color/rgb/colors.rb`.
175
+
176
+ - Improved the way that named colors are specified internally.
177
+
178
+ - Fixed bugs with Ruby 1.8.7 that may have been introduced in color 1.4.2.
179
+
180
+ - Added simplecov for test coverage analysis.
181
+
182
+ - Modernized Travis CI support.
183
+
184
+ ## 1.4.2 / 2013-06-30
185
+
186
+ - Modernized Hoe installation of Color, removing some dependencies.
187
+
188
+ - Switched to Minitest.
189
+
190
+ - Turned on Travis CI.
191
+
192
+ - Started using Code Climate.
193
+
194
+ - Small code formatting cleanup that touched pretty much every file.
195
+
196
+ ## 1.4.1 / 2010-02-03
197
+
198
+ - Imported to GitHub.
199
+
200
+ - Converted to Hoe 2.5 spec format.
201
+
202
+ ## 1.4.0 / 2007-02-11
203
+
204
+ - Merged Austin Ziegler's color-tools library (previously part of the Ruby PDF
205
+ Tools project) with Matt Lyon's color library.
206
+
207
+ - The HSL implementation from the Color class has been merged into
208
+ `Color::HSL`. Color is a module the way it was for color-tools.
209
+
210
+ - A thin veneer has been written to allow Color::new to return a `Color::HSL`
211
+ instance; `Color::HSL` supports as many methods as possible that were
212
+ previously supported by the Color class.
213
+
214
+ - Values that were previously rounded by Color are no longer rounded;
215
+ fractional values matter.
216
+
217
+ - Converted to hoe for project management.
218
+
219
+ - Moved to the next step of deprecating `Color::<name>` values; printing a
220
+ warning for each use (see the history for color-tools 1.3.0).
221
+
222
+ - Print a warning on the access of either `VERSION` or `COLOR_TOOLS_VERSION`;
223
+ the version constant is now `COLOR_VERSION`.
224
+
225
+ - Added humanized versions of accessors (e.g., CMYK colors now have both #cyan
226
+ and #c to access the cyan component of the color; #cyan provides the value as
227
+ a percentage).
228
+
229
+ - Added CSS3 formatters for RGB, RGBA, HSL, and HSLA outputs. Note that the
230
+ Color library does not yet have a way of setting alpha opacity, so the output
231
+ for RGBA and HSLA are at full alpha opacity (1.0). The values are output with
232
+ two decimal places.
233
+
234
+ - Applied a patch to provide simple arithmetic color addition and subtraction to
235
+ `Color::GrayScale` and `Color::RGB`. The patch was contributed by Jeremy
236
+ Hinegardner. This patch also provides the ability to return the maximum RGB
237
+ value as a grayscale color.
238
+
239
+ - Fixed two problems reported by Jean Krohn against color-tools relating to
240
+ RGB-to-HSL and HSL-to-RGB conversion. (Color and color-tools use the same
241
+ formulas, but the ordering of the calculations is slightly different with
242
+ Color and did not suffer from this problem; color-tools was more sensitive to
243
+ floating-point values and precision errors.)
244
+
245
+ - Fixed an issue with HSL/RGB conversions reported by Adam Johnson.
246
+
247
+ - Added an Adobe Color swatch (Photoshop) palette reader,
248
+ `Color::Palette::AdobeColor` (for `.aco` files only).
249
+
250
+ ## Color 0.1.0 / 2006-08-05
251
+
252
+ - Added HSL (degree, percent, percent) interface.
253
+
254
+ - Removed RGB instance variable; color is managed internally as HSL floating
255
+ point.
256
+
257
+ - Tests!
258
+
259
+ ## color-tools 1.3.0
260
+
261
+ - Added new metallic colors suggested by Jim Freeze. These are in the namespace
262
+ `Color::Metallic`.
263
+
264
+ - Colours that were defined in the Color namespace (e.g., `Color::Red`,
265
+ `Color::AliceBlue`) are now defined in Color::RGB (e.g., `Color::RGB::Red`,
266
+ `Color::RGB::AliceBlue`). They are added back to the Color namespace on the
267
+ first use of the old colors and a warning is printed. In version 1.4, this
268
+ warning will be printed on every use of the old colors. In version 1.5, the
269
+ backwards compatible support for colors like Color::Red will be removed
270
+ completely.
271
+
272
+ - Added the `Color::CSS` module that provides a name lookup of
273
+ `Color::RGB`-namespace constants with `Color::CSS[name]`. Most of these colors
274
+ (which are mirrored from the `Color::RGB` default colors) are only
275
+ "officially" recognised under the CSS3 color module or SVG.
276
+
277
+ - Added the `Color::HSL` color space and some helper utilities to `Color::RGB`
278
+ for color manipulation using the HSL value.
279
+
280
+ - Controlled internal value replacement to be between 0 and 1 for all colors.
281
+
282
+ - Updated `Color::Palette::Gimp` to more meaningfully deal with duplicate named
283
+ colors. Named colors now return an array of colors.
284
+
285
+ - Indicated the plans for some methods and constants out to color-tools 2.0.
286
+
287
+ - Added unit tests and fixed a number of hidden bugs because of them.
288
+
289
+ ## color-tools 1.2.0
290
+
291
+ - Changed installer from a custom-written install.rb to setup.rb 3.3.1-modified.
292
+
293
+ - Added `Color::GreyScale` (or `Color::GrayScale`).
294
+
295
+ - Added `Color::YIQ`. This color definition is incomplete; it does not have
296
+ conversions from YIQ to other color spaces.
297
+
298
+ ## color-tools 1.1.0
299
+
300
+ - Added `color/palette/gimp` to support the reading and use of GIMP color
301
+ palettes.
302
+
303
+ ## color-tools 1.0.0
304
+
305
+ - Initial release.
306
+
307
+ [color-1.8]: https://github.com/halostatue/color/tree/v1.8
308
+ [css-color]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color
309
+ [css-device-cmyk]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/device-cmyk
310
+ [issue-10]: https://github.com/halostatue/color/issues/10
311
+ [issue-30]: https://github.com/halostatue/color/issues/30
312
+ [pr-11]: https://github.com/halostatue/color/pull/11
313
+ [pr-8]: https://github.com/halostatue/color/pulls/8
314
+ [pr-36]: https://github.com/halostatue/color/pull/36
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at [INSERT CONTACT
63
+ METHOD]. All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series of
85
+ actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or permanent
92
+ ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within the
112
+ community.
113
+
114
+ ## Attribution
115
+
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.1, available at
118
+ <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
119
+
120
+ Community Impact Guidelines were inspired by
121
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
122
+
123
+ For answers to common questions about this code of conduct, see the FAQ at
124
+ <https://www.contributor-covenant.org/faq>. Translations are available at
125
+ <https://www.contributor-covenant.org/translations>.
126
+
127
+ [homepage]: https://www.contributor-covenant.org
128
+ [Mozilla CoC]: https://github.com/mozilla/diversity
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,84 @@
1
+ # Contributing
2
+
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
+
6
+ ## DO
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.
10
+
11
+ - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
+ into logical chunks as necessary.
13
+
14
+ - Use [quality commit messages][qcm].
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.)
19
+
20
+ - Add or update tests as appropriate for your change. The test suite is written
21
+ with [minitest][minitest].
22
+
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
+
27
+ ## DO NOT
28
+
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
+
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).
34
+
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][dco] for each pull
43
+ 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.
51
+
52
+ ## Test Dependencies
53
+
54
+ color uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds a
55
+ number of rake tasks. You will mostly be interested in `rake`, which runs the
56
+ tests the same way that `rake test` will do.
57
+
58
+ To assist with the installation of the development dependencies for mime-types,
59
+ I have provided the simplest possible Gemfile pointing to the (generated)
60
+ `color.gemspec` file. This will permit you to do `bundle install` to get the
61
+ development dependencies.
62
+
63
+ You can run tests with code coverage analysis by running `rake coverage`.
64
+
65
+ ## Workflow
66
+
67
+ Here's the most direct way to get your work merged into the project:
68
+
69
+ - Fork the project.
70
+ - Clone down your fork (`git clone git://github.com/<username>/color.git`).
71
+ - Create a topic branch to contain your change
72
+ (`git checkout -b my_awesome_feature`).
73
+ - Hack away, add tests. Not necessarily in that order.
74
+ - Make sure everything still passes by running `rake`.
75
+ - If necessary, rebase your commits into logical chunks, without errors.
76
+ - Push the branch up (`git push origin my_awesome_feature`).
77
+ - Create a pull request against halostatue/color and describe what your change
78
+ does and the why you think it should be merged.
79
+
80
+ [dco]: licences/dco.txt
81
+ [hoe]: https://github.com/seattlerb/hoe
82
+ [minitest]: https://github.com/seattlerb/minitest
83
+ [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
84
+ [standardrb]: https://github.com/standardrb/standard
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1,11 @@
1
+ # Contributors
2
+
3
+ - Austin Ziegler created color-tools.
4
+ - Matt Lyons created color.
5
+ - Dave Heitzman (contrast comparison, CIELAB color support)
6
+ - Thomas Sawyer
7
+ - Aaron Hill (CIE94 color matching)
8
+ - Luke Bennellick
9
+ - @stiff (CIELAB color support)
10
+ - Matthew Draper
11
+ - Charles Nutter
data/LICENCE.md ADDED
@@ -0,0 +1,50 @@
1
+ # Licence
2
+
3
+ - SPDX-License-Identifier: [MIT][mit]
4
+
5
+ - Copyright 2005-2025 Austin Ziegler, Matt Lyon, and other contributors.
6
+
7
+ The software in this repository is made available under the MIT license.
8
+
9
+ ## MIT License
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
12
+ this software and associated documentation files (the "Software"), to deal in
13
+ the Software without restriction, including without limitation the rights to
14
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15
+ the Software, and to permit persons to whom the Software is furnished to do so,
16
+ subject to the following conditions:
17
+
18
+ - The names of its contributors may not be used to endorse or promote products
19
+ derived from this software without specific prior written permission.
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
26
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
27
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
28
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+ ## Developer Certificate of Origin
32
+
33
+ All contributors **must** certify they are willing and able to provide their
34
+ contributions under the terms of this project's licences with the certification
35
+ of the [Developer Certificate of Origin (Version 1.1)](licences/dco.txt).
36
+
37
+ Such certification is provided by ensuring that a `Signed-off-by`
38
+ [commit trailer][trailer] is present on every commit:
39
+
40
+ Signed-off-by: FirstName LastName <email@example.org>
41
+
42
+ The `Signed-off-by` trailer can be automatically added by git with the `-s` or
43
+ `--signoff` option on `git commit`:
44
+
45
+ ```sh
46
+ git commit --signoff
47
+ ```
48
+
49
+ [mit]: https://spdx.org/licenses/MIT.html
50
+ [trailer]: https://git-scm.com/docs/git-interpret-trailers
data/Manifest.txt CHANGED
@@ -1,39 +1,28 @@
1
- .autotest
2
- .coveralls.yml
3
- .gemtest
4
- .hoerc
5
- .minitest.rb
6
- .travis.yml
7
- Code-of-Conduct.rdoc
8
- Contributing.rdoc
9
- Gemfile
10
- History.rdoc
11
- Licence.rdoc
1
+ CHANGELOG.md
2
+ CODE_OF_CONDUCT.md
3
+ CONTRIBUTING.md
4
+ CONTRIBUTORS.md
5
+ LICENCE.md
12
6
  Manifest.txt
13
- README.rdoc
7
+ README.md
14
8
  Rakefile
9
+ SECURITY.md
15
10
  lib/color.rb
11
+ lib/color/cielab.rb
16
12
  lib/color/cmyk.rb
17
- lib/color/css.rb
18
13
  lib/color/grayscale.rb
19
14
  lib/color/hsl.rb
20
- lib/color/palette.rb
21
- lib/color/palette/adobecolor.rb
22
- lib/color/palette/gimp.rb
23
- lib/color/palette/monocontrast.rb
24
15
  lib/color/rgb.rb
25
16
  lib/color/rgb/colors.rb
26
- lib/color/rgb/contrast.rb
27
- lib/color/rgb/metallic.rb
17
+ lib/color/version.rb
18
+ lib/color/xyz.rb
28
19
  lib/color/yiq.rb
20
+ licences/dco.txt
21
+ test/fixtures/cielab.json
29
22
  test/minitest_helper.rb
30
- test/test_adobecolor.rb
31
23
  test/test_cmyk.rb
32
24
  test/test_color.rb
33
- test/test_css.rb
34
- test/test_gimp.rb
35
25
  test/test_grayscale.rb
36
26
  test/test_hsl.rb
37
- test/test_monocontrast.rb
38
27
  test/test_rgb.rb
39
28
  test/test_yiq.rb