color 2.1.1 → 2.2.0

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: 2d4c9c7de02c29ef865bd03c3e91309c2880726e8919e2a0c8916b9e935fe1c6
4
- data.tar.gz: acfd302f192306092af688898d9186d7460c59646dce0df698cf32e29fb6212c
3
+ metadata.gz: b32b311487259ef9b4a72e7264f1eaa8a34a617918829f41b629fe814b72776f
4
+ data.tar.gz: 9fe85bc3e862e29c0fded320e03ec77063a30e86faa205c71dbae2cc6b840f28
5
5
  SHA512:
6
- metadata.gz: d7bf088dca85deeb798f0c68542fc1f1fac08e7f629e41b38c91d95537d963ce603768a290af699c5e3b71bcb3183f165c438bf8769d12fd6c84a6e0167b127b
7
- data.tar.gz: 185273ad56535d55992ab8f78aec618f9b65ce6407ee68c2c5c56475660c87d536941bea440852393030369906bc55ed5daaf1da97340f8879c743b79b583edf
6
+ metadata.gz: 712f80bb0eb3f8f04d6144d3ca0d608546b7bdf371b03d549aae1be985f73a8f84b7e615792206f32db8caf587e68cfb66f59c75c0ee1911d3af4d34efe0ed3f
7
+ data.tar.gz: ec2928f2caf9b5d9614168b0109d33743a542192e0ef2a30dc0d08b2dda5b5825bd539f9b5b477c1b96ffc3a37e8ebbacd57c5b71e18bd8cb9e77c023caec323
data/CHANGELOG.md CHANGED
@@ -1,4 +1,60 @@
1
- # Changelog
1
+ # color Changelog
2
+
3
+ ## 2.2.0 / 2026-01-DD
4
+
5
+ - When `color/rgb/colors` is loaded and the RGB color does not have defined
6
+ names, a fallback lookup to named RGB colors will be performed to use that
7
+ name.
8
+
9
+ ```ruby
10
+ simple_black = Color.from_values(r: 0, g: 0, b: 0)
11
+ stuart_black = Color.from_values(r: 0, g: 0, b: 0, names: ["semple-black-4.0"])
12
+
13
+ simple_black.name # => nil
14
+ stuart_black.name # => "semple-black-4.0"
15
+
16
+ require 'color/rgb/colors'
17
+
18
+ simple_black.name # => "black"
19
+ stuart_black.name # => "semple-black-4.0"
20
+ ```
21
+
22
+ This was suggested by [@akicho8][gh-user-akicho8] in [#89][gh-issue-89].
23
+
24
+ - The RGB inspect and pretty print formats have been modified to include defined
25
+ names. This was suggested by @akicho8 in #89.
26
+
27
+ - Added unit tests for `#pretty_print` implementations. Fixed some bugs found in
28
+ the implementations.
29
+
30
+ ## 2.1.2 / 2025-12-30
31
+
32
+ - Updated to Contributor Covenant 3.0 and applied updates to several support
33
+ documents.
34
+
35
+ - Full coverage of conversion tests. Adds CIELAB `to_yiq` and Grayscale `to_xyz`
36
+ methods. Only YIQ now lacks conversions support. Fixed in [#69][pull-69].
37
+
38
+ - Fix an incorrect conversion of CIELAB colors with low lightness to XYZ, which
39
+ caused the Y component to be ~903 times larger than correct. In practice, this
40
+ returned unexpectedly bright colours.
41
+
42
+ This also affected conversion from CIELAB to RGB, CMYK, HSL, YIQ, and
43
+ grayscale, which convert from CIELAB to XYZ as an intermediate step.
44
+
45
+ Reported by [@alexwlchan][gh-user-alexwlchan] in [#95][issue-95] and fixed in [#96][pull-96].
46
+
47
+ - Fix an incorrect comparison when converting CIE XYZ colors to RGB that could
48
+ raise a `NoMethodError` when constructing the RGB value. The conversion
49
+ incorrectly compared the absolute value of an intermediate value against the
50
+ 0.0031308 threshold instead of comparing the original value, causing certain
51
+ negative values to follow the wrong branch and return complex RGB components.
52
+
53
+ This also affected conversion from XYZ to CMYK, HSL, and YIK, and from CIELAB
54
+ to RGB, HSL, YIQ, and Grayscale -- all of which convert from XYZ to RGB as an
55
+ intermediate step.
56
+
57
+ Reported by @alexwlchan in [#92][issue-92] and fixed in [#93][pull-93].
2
58
 
3
59
  ## 2.1.1 / 2025-08-08
4
60
 
@@ -15,7 +71,7 @@ and adds more Color::XYZ white points for standard illuminants.
15
71
  was seen in `Color::RGB#to_lab` since CIELAB conversions must go through the
16
72
  XYZ color model. Even though we were using the D65 white point, the Z value
17
73
  was being clamped to 1.0 instead of the correct value of ≅1.08. Reported by
18
- @r-plus in [#45][issue-45] and fixed in [#45][pr-46].
74
+ @r-plus in [#45][issue-45] and fixed in [#45][pull-46].
19
75
 
20
76
  The resulting Color::LAB values are not _exactly_ the same values under Color
21
77
  1.8, but they are within fractional differences deemed acceptable.
@@ -99,8 +155,8 @@ this release without prior warning.
99
155
  ### 🚀 New Features
100
156
 
101
157
  - `Color::CIELAB` and `Color::XYZ` namespaces have been added. Separate
102
- implementations were submitted by David Heitzman and @stiff (in [#8][pr-8] and
103
- [#11][pr-11]), but I have reworked the code substantially. These
158
+ implementations were submitted by David Heitzman and @stiff (in [#8][pull-8]
159
+ and [#11][pull-11]), but I have reworked the code substantially. These
104
160
  implementations were originally as `Color::LAB` and include a new contrast
105
161
  calculation using the ΔE\*00 algorithm.
106
162
 
@@ -111,7 +167,7 @@ this release without prior warning.
111
167
  automated releases are enabled), full GitHub Actions, Dependabot, Standard
112
168
  Ruby, and more.
113
169
 
114
- - Charles Nutter re-added JRuby support in CI. [#36][pr-36]
170
+ - Charles Nutter re-added JRuby support in CI. [#36][pull-36]
115
171
 
116
172
  ### Governance
117
173
 
@@ -140,23 +196,22 @@ ownership to contribute it to this project under the licence terms.
140
196
  by Eric Meyer. For purposes of backwards compatibility, the previous name is
141
197
  still permitted, but its use is strongly discouraged, and it will be removed
142
198
  in the Color 2.0 release.
143
- <http://meyerweb.com/eric/thoughts/2014/06/19/rebeccapurple/>
199
+ <https://meyerweb.com/eric/thoughts/2014/06/19/rebeccapurple/>
144
200
 
145
201
  ## 1.7 / 2014-06-12
146
202
 
147
- - Added `Color::RGB::BeccaPurple` (#663399) in honour of Rebecca Meyer, the
148
- daughter of Eric Meyer, who passed away on the 7 June 2014. Her favourite
149
- color was purple. `#663399becca`
150
- <https://twitter.com/meyerweb/status/476089708674428929>
151
- <http://www.zeldman.com/2014/06/10/the-color-purple/>
152
- <http://discourse.specifiction.org/t/name-663399-becca-purple-in-css4-color/225>
203
+ - Added `Color::RGB::BeccaPurple` ([#663399][gh-issue-663399]) in honour of Rebecca Meyer, the
204
+ daughter of Eric Meyer, who passed away on 7 June 2014. Her favourite color
205
+ was purple. `#663399becca`
206
+ <https://www.zeldman.com/2014/06/10/the-color-purple/>
207
+ <https://discourse.wicg.io/t/name-663399-becca-purple-in-css4-color/225/>
153
208
 
154
209
  - Changed the homepage in the gem to point to GitHub instead of RubyForge, which
155
- has been shut down. Fixes [#10][issue-10], reported by @voxik.
210
+ has been shut down. Fixes [#10][issue-10], reported by [@voxik][gh-user-voxik].
156
211
 
157
212
  ## 1.6 / 2014-05-19
158
213
 
159
- - Aaron Hill (@armahillo) implemented the CIE Delta E 94 method by which an RGB
214
+ - Aaron Hill ([@armahillo][gh-user-armahillo]) implemented the CIE Delta E 94 method by which an RGB
160
215
  color can be asked for the closest matching color from a list of provided
161
216
  colors. Fixes [#5][issue-5].
162
217
 
@@ -191,7 +246,7 @@ ownership to contribute it to this project under the licence terms.
191
246
  this work, color classes should `include` Color only need to implement
192
247
  `#coerce(other)`, `#to_a`, and supported conversion methods (e.g., `#to_rgb`).
193
248
 
194
- - Added @daveheitzman's initial implementation of a RGB contrast method as an
249
+ - Added [@daveheitzman][gh-user-daveheitzman]'s initial implementation of a RGB contrast method as an
195
250
  extension file: `require 'color/rgb/contrast'`. This method and the value it
196
251
  returns should be considered experimental; it requires further examination to
197
252
  ensure that the results produced are consistent with the contrast comparisons
@@ -338,8 +393,25 @@ ownership to contribute it to this project under the licence terms.
338
393
  [issue-10]: https://github.com/halostatue/color/issues/10
339
394
  [issue-30]: https://github.com/halostatue/color/issues/30
340
395
  [issue-45]: https://github.com/halostatue/color/issues/45
341
- [pr-11]: https://github.com/halostatue/color/pull/11
342
- [pr-36]: https://github.com/halostatue/color/pull/36
343
- [pr-46]: https://github.com/halostatue/pull/46
344
- [pr-8]: https://github.com/halostatue/color/pulls/8
396
+ [issue-4]: https://github.com/halostatue/color/issues/4
397
+ [issue-5]: https://github.com/halostatue/color/issues/5
398
+ [issue-92]: https://github.com/halostatue/color/issues/92
399
+ [issue-95]: https://github.com/halostatue/color/issues/95
400
+ [pull-11]: https://github.com/halostatue/color/pull/11
401
+ [pull-15]: https://github.com/halostatue/color/pull/15
402
+ [pull-18]: https://github.com/halostatue/color/pull/18
403
+ [pull-24]: https://github.com/halostatue/color/pull/24
404
+ [pull-36]: https://github.com/halostatue/color/pull/36
405
+ [pull-46]: https://github.com/halostatue/color/pull/46
406
+ [pull-69]: https://github.com/halostatue/color/pull/69
407
+ [pull-8]: https://github.com/halostatue/color/pulls/8
408
+ [pull-93]: https://github.com/halostatue/color/pull/93
409
+ [pull-96]: https://github.com/halostatue/color/pull/96
345
410
  [wp-std-illuminant]: https://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants
411
+ [gh-user-akicho8]: https://github.com/akicho8
412
+ [gh-issue-89]: https://github.com/halostatue/color/issues/89
413
+ [gh-user-alexwlchan]: https://github.com/alexwlchan
414
+ [gh-issue-663399]: https://github.com/halostatue/color/issues/663399
415
+ [gh-user-voxik]: https://github.com/voxik
416
+ [gh-user-armahillo]: https://github.com/armahillo
417
+ [gh-user-daveheitzman]: https://github.com/daveheitzman
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,128 +1,166 @@
1
- # Contributor Covenant Code of Conduct
1
+ # Contributor Covenant 3.0 Code of Conduct
2
2
 
3
3
  ## Our Pledge
4
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.
5
+ We pledge to make our community welcoming, safe, and equitable for all.
6
+
7
+ We are committed to fostering an environment that respects and promotes the
8
+ dignity, rights, and contributions of all individuals, regardless of
9
+ characteristics including race, ethnicity, caste, color, age, physical
10
+ characteristics, neurodiversity, disability, sex or gender, gender identity or
11
+ expression, sexual orientation, language, philosophy or religion, national or
12
+ social origin, socio-economic position, level of education, or other status. The
13
+ same privileges of participation are extended to everyone who participates in
14
+ good faith and in accordance with this Covenant.
15
+
16
+ ## Encouraged Behaviors
17
+
18
+ While acknowledging differences in social norms, we all strive to meet our
19
+ community's expectations for positive behavior. We also understand that our
20
+ words and actions may be interpreted differently than we intend based on
21
+ culture, background, or native language.
22
+
23
+ With these considerations in mind, we agree to behave mindfully toward each
24
+ other and act in ways that center our shared values, including:
25
+
26
+ 1. Respecting the **purpose of our community**, our activities, and our ways of
27
+ gathering.
28
+ 2. Engaging **kindly and honestly** with others.
29
+ 3. Respecting **different viewpoints** and experiences.
30
+ 4. **Taking responsibility** for our actions and contributions.
31
+ 5. Gracefully giving and accepting **constructive feedback**.
32
+ 6. Committing to **repairing harm** when it occurs.
33
+ 7. Behaving in other ways that promote and sustain the **well-being of our
34
+ community**.
35
+
36
+ ## Restricted Behaviors
37
+
38
+ We agree to restrict the following behaviors in our community. Instances,
39
+ threats, and promotion of these behaviors are violations of this Code of
40
+ Conduct.
41
+
42
+ 1. **Harassment.** Violating explicitly expressed boundaries or engaging in
43
+ unnecessary personal attention after any clear request to stop.
44
+ 2. **Character attacks.** Making insulting, demeaning, or pejorative comments
45
+ directed at a community member or group of people.
46
+ 3. **Stereotyping or discrimination.** Characterizing anyone’s personality or
47
+ behavior on the basis of immutable identities or traits.
48
+ 4. **Sexualization.** Behaving in a way that would generally be considered
49
+ inappropriately intimate in the context or purpose of the community.
50
+ 5. **Violating confidentiality**. Sharing or acting on someone's personal or
51
+ private information without their permission.
52
+ 6. **Endangerment.** Causing, encouraging, or threatening violence or other harm
53
+ toward any person or group.
54
+ 7. Behaving in other ways that **threaten the well-being** of our community.
55
+
56
+ ### Other Restrictions
57
+
58
+ 1. **Misleading identity.** Impersonating someone else for any reason, or
59
+ pretending to be someone else to evade enforcement actions.
60
+ 2. **Failing to credit sources.** Not properly crediting the sources of content
61
+ you contribute.
62
+ 3. **Promotional materials**. Sharing marketing or other commercial content in a
63
+ way that is outside the norms of the community.
64
+ 4. **Irresponsible communication.** Failing to responsibly present content which
65
+ includes, links or describes any other restricted behaviors.
66
+
67
+ ## Reporting an Issue
68
+
69
+ Tensions can occur between community members even when they are trying their
70
+ best to collaborate. Not every conflict represents a code of conduct violation,
71
+ and this Code of Conduct reinforces encouraged behaviors and norms that can help
72
+ avoid conflicts and minimize harm.
73
+
74
+ When an incident does occur, it is important to report it promptly. To report a
75
+ possible violation, create a [private security advisory][advisory] — violations
76
+ of this code of conduct are considered security vulnerabilities.
77
+
78
+ Community Moderators take reports of violations seriously and will make every
79
+ effort to respond in a timely manner. They will investigate all reports of code
80
+ of conduct violations, reviewing messages, logs, and recordings, or interviewing
81
+ witnesses and other participants. Community Moderators will keep investigation
82
+ and enforcement actions as transparent as possible while prioritizing safety and
83
+ confidentiality. In order to honor these values, enforcement actions are carried
84
+ out in private with the involved parties, but communicating to the whole
85
+ community may be part of a mutually agreed upon resolution.
86
+
87
+ ## Addressing and Repairing Harm
88
+
89
+ If an investigation by the Community Moderators finds that this Code of Conduct
90
+ has been violated, the following enforcement ladder may be used to determine how
91
+ best to repair harm, based on the incident's impact on the individuals involved
92
+ and the community as a whole. Depending on the severity of a violation, lower
93
+ rungs on the ladder may be skipped.
94
+
95
+ 1. Warning
96
+ 1. Event: A violation involving a single incident or series of incidents.
97
+ 2. Consequence: A private, written warning from the Community Moderators.
98
+ 3. Repair: Examples of repair include a private written apology,
99
+ acknowledgement of responsibility, and seeking clarification on
100
+ expectations.
101
+
102
+ 2. Temporarily Limited Activities
103
+ 1. Event: A repeated incidence of a violation that previously resulted in a
104
+ warning, or the first incidence of a more serious violation.
105
+ 2. Consequence: A private, written warning with a time-limited cooldown
106
+ period designed to underscore the seriousness of the situation and give
107
+ the community members involved time to process the incident. The cooldown
108
+ period may be limited to particular communication channels or interactions
109
+ with particular community members.
110
+ 3. Repair: Examples of repair may include making an apology, using the
111
+ cooldown period to reflect on actions and impact, and being thoughtful
112
+ about re-entering community spaces after the period is over.
113
+
114
+ 3. Temporary Suspension
115
+ 1. Event: A pattern of repeated violation which the Community Moderators have
116
+ tried to address with warnings, or a single serious violation.
117
+ 2. Consequence: A private written warning with conditions for return from
118
+ suspension. In general, temporary suspensions give the person being
119
+ suspended time to reflect upon their behavior and possible corrective
120
+ actions.
121
+ 3. Repair: Examples of repair include respecting the spirit of the
122
+ suspension, meeting the specified conditions for return, and being
123
+ thoughtful about how to reintegrate with the community when the suspension
124
+ is lifted.
125
+
126
+ 4. Permanent Ban
127
+ 1. Event: A pattern of repeated code of conduct violations that other steps
128
+ on the ladder have failed to resolve, or a violation so serious that the
129
+ Community Moderators determine there is no way to keep the community safe
130
+ with this person as a member.
131
+ 2. Consequence: Access to all community spaces, tools, and communication
132
+ channels is removed. In general, permanent bans should be rarely used,
133
+ should have strong reasoning behind them, and should only be resorted to
134
+ if working through other remedies has failed to change the behavior.
135
+ 3. Repair: There is no possible repair in cases of this severity.
136
+
137
+ This enforcement ladder is intended as a guideline. It does not limit the
138
+ ability of Community Managers to use their discretion and judgment, in keeping
139
+ with the best interests of our community.
50
140
 
51
141
  ## Scope
52
142
 
53
143
  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
144
+ an individual is officially representing the community in public or other
145
+ spaces. Examples of representing our community include using an official email
146
+ address, posting via an official social media account, or acting as an appointed
57
147
  representative at an online or offline event.
58
148
 
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
149
  ## Attribution
115
150
 
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>.
151
+ This Code of Conduct is adapted from the Contributor Covenant, version 3.0,
152
+ permanently available at <https://www.contributor-covenant.org/version/3/0/>.
119
153
 
120
- Community Impact Guidelines were inspired by
121
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
154
+ Contributor Covenant is stewarded by the Organization for Ethical Source and
155
+ licensed under CC BY-SA 4.0. To view a copy of this license, visit
156
+ <https://creativecommons.org/licenses/by-sa/4.0/>.
122
157
 
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>.
158
+ For answers to common questions about Contributor Covenant, see the FAQ at
159
+ <https://www.contributor-covenant.org/faq>. Translations are provided at
160
+ <https://www.contributor-covenant.org/translations>. Additional enforcement and
161
+ community guideline resources can be found at
162
+ <https://www.contributor-covenant.org/resources>. The enforcement ladder was
163
+ inspired by the work of [Mozilla’s code of conduct team][inclusion].
126
164
 
127
- [homepage]: https://www.contributor-covenant.org
128
- [Mozilla CoC]: https://github.com/mozilla/diversity
165
+ [advisory]: https://github.com/halostatue/color/security/advisories/new
166
+ [inclusion]: https://github.com/mozilla/inclusion
data/CONTRIBUTING.md CHANGED
@@ -1,84 +1,123 @@
1
1
  # Contributing
2
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.
3
+ Contribution to Color is encouraged: bug reports, feature requests, or code
4
+ contributions. New features should be proposed and discussed in an
5
+ [issue][issues].
5
6
 
6
- ## DO
7
+ Before contributing patches, please read the [Licence](./LICENCE.md).
7
8
 
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.
9
+ Color is governed under the [Contributor Covenant Code of Conduct][cccoc].
10
10
 
11
- - Use thoughtfully-named topic branches for contributions. Rebase your commits
12
- into logical chunks as necessary.
11
+ ## Code Guidelines
13
12
 
14
- - Use [quality commit messages][qcm].
13
+ I have several guidelines to contributing code through pull requests:
15
14
 
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.)
15
+ - All code changes require tests. In most cases, this will be added or updated
16
+ unit tests. I use [Minitest][minitest].
19
17
 
20
- - Add or update tests as appropriate for your change. The test suite is written
21
- with [minitest][minitest].
18
+ - I use code formatters, static analysis tools, and linting to ensure consistent
19
+ styles and formatting. There should be no warning output from test run
20
+ processes. I use [Standard Ruby][standardrb].
22
21
 
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.
22
+ - Proposed changes should be on a thoughtfully-named topic branch and organized
23
+ into logical commit chunks as appropriate.
26
24
 
27
- ## DO NOT
25
+ - Use [Conventional Commits][conventional] with my
26
+ [conventions](#commit-conventions).
28
27
 
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.
28
+ - Versions must not be updated in pull requests unless otherwise directed. This
29
+ means that you must not:
31
30
 
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).
31
+ - Modify `VERSION` in `lib/color/version.rb`. When your patch is accepted and
32
+ a release is made, the version will be updated at that point.
34
33
 
35
- - Modify the `Gemfile`.
34
+ - Modify `color.gemspec`; it is a generated file. (You _may_ use
35
+ `rake gemspec` to regenerate it if your change involves metadata related to
36
+ gem itself).
36
37
 
37
- ## LLM-Generated Contribution Policy
38
+ - Modify the `Gemfile`.
38
39
 
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)).
40
+ - Documentation should be added or updated as appropriate for new or updated
41
+ functionality. The documentation is RDoc; color does not use extensions that
42
+ may be present in alternative documentation generators.
43
+
44
+ - All GitHub Actions checks marked as required must pass before a pull request
45
+ may be accepted and merged.
46
+
47
+ - Add your name or GitHub handle to `CONTRIBUTORS.md` and a record in the
48
+ `CHANGELOG.md` as a separate commit from your main change. (Follow the style
49
+ in the `CHANGELOG.md` and provide a link to your PR.)
44
50
 
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**.
51
+ - Include your DCO sign-off in each commit message (see [LICENCE](LICENCE.md)).
48
52
 
49
- Any contribution (bug, feature request, or pull request) that uses unreviewed
50
- LLM output will be rejected.
53
+ ## AI Contribution Policy
54
+
55
+ Color is a library full of complex math and subtle decisions (some of them
56
+ possibly even wrong). It is extremely important that contributions of any sort
57
+ be well understood by the submitter and that the developer can attest to the
58
+ [Developer Certificate of Origin][dco] for each pull request (see
59
+ [LICENCE](LICENCE.md)).
60
+
61
+ Any contribution (bug, feature request, or pull request) that uses undeclared AI
62
+ output will be rejected.
51
63
 
52
64
  ## Test Dependencies
53
65
 
54
- color uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds a
66
+ Color uses Ryan Davis's [Hoe][Hoe] to manage the release process, and it adds a
55
67
  number of rake tasks. You will mostly be interested in `rake`, which runs the
56
68
  tests the same way that `rake test` will do.
57
69
 
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)
70
+ To assist with the installation of the development dependencies for color, I
71
+ have provided the simplest possible Gemfile pointing to the (generated)
60
72
  `color.gemspec` file. This will permit you to do `bundle install` to get the
61
73
  development dependencies.
62
74
 
63
75
  You can run tests with code coverage analysis by running `rake coverage`.
64
76
 
65
- ## Workflow
77
+ ## Commit Conventions
78
+
79
+ Color has adopted a variation of the Conventional Commits format for commit
80
+ messages. The following types are permitted:
81
+
82
+ | Type | Purpose |
83
+ | ------- | ----------------------------------------------------- |
84
+ | `feat` | A new feature |
85
+ | `fix` | A bug fix |
86
+ | `chore` | A code change that is neither a bug fix nor a feature |
87
+ | `docs` | Documentation updates |
88
+ | `deps` | Dependency updates, including GitHub Actions. |
89
+
90
+ I encourage the use of [Tim Pope's][tpope-qcm] or [Chris Beam's][cbeams]
91
+ guidelines on the writing of commit messages
92
+
93
+ I require the use of [git][trailers1] [trailers][trailers2] for specific
94
+ additional metadata and strongly encourage it for others. The conditionally
95
+ required metadata trailers are:
96
+
97
+ - `Breaking-Change`: if the change is a breaking change. **Do not** use the
98
+ shorthand form (`feat!(scope)`) or `BREAKING CHANGE`.
99
+
100
+ - `Signed-off-by`: this is required for all developers except me, as outlined in
101
+ the [Licence](./LICENCE.md#developer-certificate-of-origin).
66
102
 
67
- Here's the most direct way to get your work merged into the project:
103
+ - `Fixes` or `Resolves`: If a change fixes one or more open [issues][issues],
104
+ that issue must be included in the `Fixes` or `Resolves` trailer. Multiple
105
+ issues should be listed comma separated in the same trailer:
106
+ `Fixes: #1, #5, #7`, but _may_ appear in separate trailers. While both `Fixes`
107
+ and `Resolves` are synonyms, only _one_ should be used in a given commit or
108
+ pull request.
68
109
 
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.
110
+ - `Related to`: If a change does not fix an issue, those issue references should
111
+ be included in this trailer.
79
112
 
113
+ [cbeams]: https://cbea.ms/git-commit/
114
+ [cccoc]: ./CODE_OF_CONDUCT.md
115
+ [conventional]: https://www.conventionalcommits.org/en/v1.0.0/
80
116
  [dco]: licences/dco.txt
81
117
  [hoe]: https://github.com/seattlerb/hoe
118
+ [issues]: https://github.com/halostatue/color/issues
82
119
  [minitest]: https://github.com/seattlerb/minitest
83
- [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
84
120
  [standardrb]: https://github.com/standardrb/standard
121
+ [tpope-qcm]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
122
+ [trailers1]: https://git-scm.com/docs/git-interpret-trailers
123
+ [trailers2]: https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---trailerlttokengtltvaluegt
data/CONTRIBUTORS.md CHANGED
@@ -6,7 +6,12 @@
6
6
  - Thomas Sawyer
7
7
  - Aaron Hill (CIE94 color matching)
8
8
  - Luke Bennellick
9
- - @stiff (CIELAB color support)
10
- - @r-plus
9
+ - [@stiff][gh-user-stiff] (CIELAB color support)
10
+ - [@r-plus][gh-user-r-plus]
11
11
  - Matthew Draper
12
12
  - Charles Nutter
13
+ - Paul Gallagher
14
+ - Alex Chan
15
+
16
+ [gh-user-stiff]: https://github.com/stiff
17
+ [gh-user-r-plus]: https://github.com/r-plus