Skip to content
durableprogrammingPublic

About

Ruby gem for parsing, converting, and manipulating colors in hex, RGB, HSL, OKLCH, and named formats.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

1 watching

Forks

Repository files navigation

Abachrome

License: MIT Ruby Gem Version Downloads GitHub repo size PRs Welcome RuboCop Maturity Level Website

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.

Abachrome Logo

Getting Help

Questions about Abachrome? Practical Ruby Gems is a good place to get them answered.

Installation

Add this line to your application's Gemfile:

gem 'abachrome'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install abachrome

Quick Start

color = 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.

Features

  • 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

Requirements

  • Ruby >= 3.0.0

Documentation

Security

Please report security issues privately. See SECURITY.md rather than opening a public issue.

License

The gem is available as open source under the terms of the MIT License.

Acknowledgement

We'd like to thank the excellent Color.js and culori color libraries, which helped inspire this project and inform its design.

Commercial Support

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

Copyright 2025, Durable Programming LLC. All rights reserved.

About

Ruby gem for parsing, converting, and manipulating colors in hex, RGB, HSL, OKLCH, and named formats.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages