color Changelog
2.1.2 / 2025-12-30
-
Updated to Contributor Covenant 3.0 and applied updates to several support documents.
-
Full coverage of conversion tests. Adds CIELAB
to_yiqand Grayscaleto_xyzmethods. Only YIQ now lacks conversions support. Fixed in #69. -
Fix an incorrect conversion of CIELAB colors with low lightness to XYZ, which caused the Y component to be ~903 times larger than correct. In practice, this returned unexpectedly bright colours.
This also affected conversion from CIELAB to RGB, CMYK, HSL, YIQ, and grayscale, which convert from CIELAB to XYZ as an intermediate step.
Reported by @alexwlchan in #95 and fixed in #96.
-
Fix an incorrect comparison when converting CIE XYZ colors to RGB that could raise a
NoMethodErrorwhen constructing the RGB value. The conversion incorrectly compared the absolute value of an intermediate value against the 0.0031308 threshold instead of comparing the original value, causing certain negative values to follow the wrong branch and return complex RGB components.
This also affected conversion from XYZ to CMYK, HSL, and YIK, and from CIELAB to RGB, HSL, YIQ, and Grayscale – all of which convert from XYZ to RGB as an intermediate step.
Reported by @alexwlchan in #92 and fixed in #93.
2.1.1 / 2025-08-08
Color 2.1.1 fixes a bug where Color::RGB::Black and Color::RGB::White are no longer defined automatically because they are part of color/rgb/colors. Internally, this defines Color::RGB::Black000 and Color::RGB::WhiteFFF.
2.1.0 / 2025-07-20
Color 2.1.0 fixes a computation bug where CIE XYZ values were improperly clamped and adds more Color::XYZ white points for standard illuminants.
-
Fixes a bug where standard illuminant white points were improperly clamped and was seen in
Color::RGB#to_labsince CIELAB conversions must go through the XYZ color model. Even though we were using the D65 white point, the Z value was being clamped to 1.0 instead of the correct value of ≅1.08. Reported by @r-plus in #45 and fixed in #45.
The resulting Color::LAB values are not exactly the same values under Color 1.8, but they are within fractional differences deemed acceptable.
-
Added more white points for standard illuminants in the Color::XYZ::WP2 constant. The values here were derived from the White points of standard illuminants using the
xyYtoXYZconversion formula whereX = (x * Y) / yandZ = ((1 - x - y) * Y) / y. Only the values for CIE 1931 2° were computed. The values for Color::XYZ::D50 and Color::XYZ::D65 were replaced with these computed values.
2.0.1 / 2025-07-05
Color 2.0.1 is a minor documentation update.
2.0.0 / 2025-07-05
Color 2.0.0 is a major release of the Color library.
đź’Ł Breaking Changes
Color 2.0 contains breaking changes. Functionality previously deprecated has been removed, but other functionality has been changed or removed as part of this release without prior warning.
-
The minimum supported version of Ruby is 3.2.
-
Colorclasses are now immutable implementations of Data objects (first introduced in Ruby 3.2). This will restrictColor2 from running on versions of JRuby before JRuby 10. -
The constants
Color::COLOR_VERSIONandColor::COLOR_TOOLS_VERSIONhave been removed; there is onlyColor::VERSION. This reverses a planned deprecation decision made more than ten years ago that no longer makes sense. -
All named color classes at
Colorhave been removed as planned. -
Color::RGB::BeccaPurplehas been removed as an alias forColor::RGB::RebeccaPurple. -
The pseudo-constructor
Color.newhas been removed. -
Colorclass constructors no longer yield the constructed color if a block is passed. -
Renamed
Color::COLOR_EPSILONandColor::COLOR_TOLERANCEtoColor::EPSILONandColor::TOLERANCE. These aren't private constants because they need to be accessed throughoutColor, but they are internal constants that should not be used outside of theColorlibrary or functions exposed therein. -
PDF format functions pdf_fill and pdf_stroke have been removed from
Color::CMYK,Color::Grayscale, andColor::RGB. The supporting internal constantsColor::<class>::PDF_FORMAT_STRhave also been removed. -
Palette processing classes,
Color::Palette::AdobeColor,Color::Palette::Gimp, andColor::Palette::MonoContrasthave been removed. Persons interested in using these are encouraged to extract them from Color 1.8 and adapt them to useColor2.0 APIs. -
CSS methods (css_rgb, css_rgba, css_hsl, css_hsla) have been replaced with css on color classes that have CSS representations. The output of css differs (
Color1.8 used the legacy CSS color formats;Color2.0 uses modern CSS color formats). -
Color::GrayScalehas been renamed toColor::Grayscale. The alias constantColor::GreyScalehas been removed. -
The html method has been removed from all color classes except
Color::RGB. -
Named RGB colors are no longer defined automatically, but must be loaded explicitly by requiring
color/rgb/colors. This resolves #30. The use ofColor::RGB#extract_colors,Color::RGB.by_hex,Color::RGB.by_name, orColor::RGB.by_csswill requirecolor/rgb/colorsautomatically as they require the presence of the named colors. -
Color:CSS#[]has been removed, as has the containing namespace. It has always been a shallow wrapper aroundColor::RGB.by_name.
🚀 New Features
-
Color::CIELABandColor::XYZnamespaces have been added. Separate implementations were submitted by David Heitzman and @stiff (in #8 and #11), but I have reworked the code substantially. These implementations were originally asColor::LABand include a new contrast calculation using the ΔE*00 algorithm.
Internal
-
Updated project structure for how I manage Ruby libraries in 2025. This includes increased release security (MFA is required for all releases, automated releases are enabled), full GitHub Actions, Dependabot, Standard Ruby, and more.
-
Charles Nutter re-added JRuby support in CI. #36
Governance
Color 2.0 and later requires that all contributions be signed-off attesting that the developer created the change and has the appropriate permissions or ownership to contribute it to this project under the licence terms.
1.8 / 2015-10-26
-
Add an optional
alphaparameter to all css calls. Thanks to Luke Bennellick (@bennell) and Alexander Popov (@AlexWayfer) for independently implemented submissions. Merged from [#15]. -
Improve constant detection to prevent incorrectly identified name collisions with various other libraries such as Azure deployment tools. Based on work by Matthew Draper (@matthewd) in [#24].
-
Prevent
Color.equivalent?comparisons from using non-Color types for comparison. Fix provided by Benjamin Guest (@bguest) in [#18]. -
This project now has a Code of Conduct.
1.7.1 / 2014-06-12
-
Renamed
Color::RGB::BeccaPurpletoColor::RGB::RebeccaPurpleas stipulated by Eric Meyer. For purposes of backwards compatibility, the previous name is still permitted, but its use is strongly discouraged, and it will be removed in theColor2.0 release. meyerweb.com/eric/thoughts/2014/06/19/rebeccapurple/
1.7 / 2014-06-12
-
Added
Color::RGB::BeccaPurple(#663399) in honour of Rebecca Meyer, the daughter of Eric Meyer, who passed away on the 7 June 2014. Her favourite color was purple.#663399beccatwitter.com/meyerweb/status/476089708674428929 www.zeldman.com/2014/06/10/the-color-purple/ discourse.specifiction.org/t/name-663399-becca-purple-in-css4-color/225 -
Changed the homepage in the gem to point to GitHub instead of RubyForge, which has been shut down. Fixes #10, reported by @voxik.
1.6 / 2014-05-19
-
Aaron Hill (@armahillo) implemented the CIE Delta E 94 method by which an RGB color can be asked for the closest matching color from a list of provided colors. Fixes [#5].
-
To implement closest_match and delta_e94, conversion methods for sRGB to XYZ and XYZ to L*a*b* space were implemented. These should be considered experimental.
-
Ensured that the gem manifest was up-to-date. Fixes [#4] reported by @boutil. Thanks!
-
Fixed problems with Travis builds. Note that Ruby 1.9.2 is no longer tested. Rubinius remains in a 'failure-tolerated' mode.
-
Color1.6 is, barring security patches, the last release ofColorthat will support Ruby 1.8.
1.5.1 / 2014-01-28
-
color 1.5 was a yanked release.
-
Added new methods to
Color::RGBto make it so that the default defined colors can be looked up by hex, name, or both. -
Added a method to
Color::RGBto extract colors from text by hex, name, or both. -
Added new common methods for color names. Converted colors do not retain names.
-
Restructured color comparisons to use protocols instead of custom implementations. This makes it easier to implement new color classes. To make this work, color classes should
includeColoronly need to implement coerce(other), to_a, and supported conversion methods (e.g., to_rgb). -
Added @daveheitzman’s initial implementation of a RGB contrast method as an extension file:
require 'color/rgb/contrast'. This method and the value it returns should be considered experimental; it requires further examination to ensure that the results produced are consistent with the contrast comparisons used inColor::Palette::MonoContrast. -
Reducing duplicated code.
-
Moved
lib/color/rgb-colors.rbto lib/color/rgb/colors.rb. -
Improved the way that named colors are specified internally.
-
Fixed bugs with Ruby 1.8.7 that may have been introduced in color 1.4.2.
-
Added simplecov for test coverage analysis.
-
Modernized Travis CI support.
1.4.2 / 2013-06-30
-
Modernized Hoe installation of
Color, removing some dependencies. -
Switched to Minitest.
-
Turned on Travis CI.
-
Started using Code Climate.
-
Small code formatting cleanup that touched pretty much every file.
1.4.1 / 2010-02-03
-
Imported to GitHub.
-
Converted to Hoe 2.5 spec format.
1.4.0 / 2007-02-11
-
Merged Austin Ziegler's color-tools library (previously part of the Ruby PDF Tools project) with Matt Lyon's color library.
-
The HSL implementation from the
Colorclass has been merged intoColor::HSL.Coloris a module the way it was for color-tools. -
A thin veneer has been written to allow Color::new to return a
Color::HSLinstance;Color::HSLsupports as many methods as possible that were previously supported by theColorclass. -
Values that were previously rounded by
Colorare no longer rounded; fractional values matter. -
Converted to hoe for project management.
-
Moved to the next step of deprecating
Color::<name>values; printing a warning for each use (see the history for color-tools 1.3.0). -
Print a warning on the access of either
VERSIONorCOLOR_TOOLS_VERSION; the version constant is nowCOLOR_VERSION. -
Added humanized versions of accessors (e.g., CMYK colors now have both cyan and c to access the cyan component of the color; cyan provides the value as a percentage).
-
Added CSS3 formatters for RGB, RGBA, HSL, and HSLA outputs. Note that the
Colorlibrary does not yet have a way of setting alpha opacity, so the output for RGBA and HSLA are at full alpha opacity (1.0). The values are output with two decimal places. -
Applied a patch to provide simple arithmetic color addition and subtraction to
Color::GrayScaleandColor::RGB. The patch was contributed by Jeremy Hinegardner. This patch also provides the ability to return the maximum RGB value as a grayscale color. -
Fixed two problems reported by Jean Krohn against color-tools relating to RGB-to-HSL and HSL-to-RGB conversion. (
Colorand color-tools use the same formulas, but the ordering of the calculations is slightly different withColorand did not suffer from this problem; color-tools was more sensitive to floating-point values and precision errors.) -
Fixed an issue with HSL/RGB conversions reported by Adam Johnson.
-
Added an Adobe
Colorswatch (Photoshop) palette reader,Color::Palette::AdobeColor(for.acofiles only).
Color 0.1.0 / 2006-08-05
-
Added HSL (degree, percent, percent) interface.
-
Removed RGB instance variable; color is managed internally as HSL floating point.
-
Tests!
color-tools 1.3.0
-
Added new metallic colors suggested by Jim Freeze. These are in the namespace
Color::Metallic. -
Colours that were defined in the
Colornamespace (e.g.,Color::Red,Color::AliceBlue) are now defined inColor::RGB(e.g.,Color::RGB::Red,Color::RGB::AliceBlue). They are added back to theColornamespace on the first use of the old colors and a warning is printed. In version 1.4, this warning will be printed on every use of the old colors. In version 1.5, the backwards compatible support for colors like Color::Red will be removed completely. -
Added the
Color::CSSmodule that provides a name lookup ofColor::RGB-namespace constants withColor::CSS[name]. Most of these colors (which are mirrored from theColor::RGBdefault colors) are only “officially” recognised under the CSS3 color module or SVG. -
Added the
Color::HSLcolor space and some helper utilities toColor::RGBfor color manipulation using the HSL value. -
Controlled internal value replacement to be between 0 and 1 for all colors.
-
Updated
Color::Palette::Gimpto more meaningfully deal with duplicate named colors. Named colors now return an array of colors. -
Indicated the plans for some methods and constants out to color-tools 2.0.
-
Added unit tests and fixed a number of hidden bugs because of them.
color-tools 1.2.0
-
Changed installer from a custom-written install.rb to setup.rb 3.3.1-modified.
-
Added
Color::GreyScale(orColor::GrayScale). -
Added
Color::YIQ. This color definition is incomplete; it does not have conversions from YIQ to other color spaces.
color-tools 1.1.0
-
Added
color/palette/gimpto support the reading and use of GIMP color palettes.
color-tools 1.0.0
-
Initial release.