Abachrome is a Ruby gem for parsing, manipulating, and managing colors. It provides a robust set of tools for working with various color formats including hex, RGB, HSL, and named colors.
Questions about Abachrome? Practical Ruby Gems is a good place to get them answered.
Add this line to your application's Gemfile:
gem 'abachrome'And then execute:
$ bundle installOr install it yourself as:
$ gem install abachromecolor = Abachrome.from_hex('#FF0000')
other = Abachrome::Parsers::CSS.parse('oklch(0.5 0.2 120)')
oklab = color.to_oklab
lighter = color.lighten(0.2)
blended = color.blend(other, 0.5)
Abachrome::Outputs::CSS.format_rgb(color) # => "rgb(255, 0, 0)"See docs/usage.md for parsing, conversion, output formats, manipulation, palettes, and gamut mapping.
- Support for multiple color spaces (RGB, HSL, Lab, Oklab, OKLCH, XYZ, LMS)
- Color space conversion between all supported spaces
- Advanced gamut mapping for sRGB, P3, and Rec.2020
- Comprehensive CSS color parsing and formatting
- Support for CSS named colors
- Color blending and lightness adjustments
- Palette creation and interpolation
- High-precision color calculations using BigDecimal
- Alpha channel support throughout all operations
- Ruby >= 3.0.0
- Usage
- Dependencies
- Development and testing
- Contributing, including how to report defects
- Governance
- Security policy
- Changelog
Please report security issues privately. See SECURITY.md rather than opening a public issue.
The gem is available as open source under the terms of the MIT License.
We'd like to thank the excellent Color.js and culori color libraries, which helped inspire this project and inform its design.
Commercial support for this tool is available from Durable Programming, LLC. You can find out more at durableprogramming.com or via email at commercial@durableprogramming.com.
Copyright 2025, Durable Programming LLC. All rights reserved.
