#rgb #conversion #hsl #color-conversion #graphics #color #color-space


A Rust library for working with (and converting) colors in different spaces

7 unstable releases (3 breaking)

0.3.1 Mar 22, 2022
0.3.0 Mar 22, 2022
0.2.0 Mar 20, 2022
0.1.1 Mar 20, 2022
0.0.1 Jan 25, 2022

#768 in Images


1.5K SLoC

Sorbet Color - We did your homework.

GitHub issues GitHub forks GitHub stars Crates.io downloads Crates.io license Crates.io version

This crate is a component of the work-in-progress GUI library by the same name, Sorbet.

It should be handy as a standalone library for all of your color-conversion needs.

This crate provides convenient types to represent colors in different formats/models/spaces. All color structures have the Color trait which specifies bounds for conversion between every other color structure.


The transparency/alpha component as structure fields is always fully spelled-out as alpha, to differentiate it from any color models that may have an a component (none handled by this library thus-far).

Most of the mathematics used here will be based on the algorithms found on Wikipedia or other crowd-sourced references.

This library is incomplete and is missing important spaces such as CIE XYZ, LUV, and LAB.

Some interesting reading about the CIE 1931 color space can be found on Wikipedia.

If you would like to utilize this crate and there is a format missing, please open a new issue on the GitHub repository after searching to make sure a request hasn't already been submitted.

Pull requests are very welcome.


See Versioning for Sorbet.

## It is recommended to use the latest version while the public API is unstable.
sorbet-color = "*"
## Otherwise, if you would like to not worry about updating the dependency,
## feel free to use the latest minor version and leave it at that.
sorbet-color = "0.X"


Copyright © 2022 Jacob Birkett

This project is provided under the Apache License, Version 2.0.

🟢 Permissions 🟡 Conditions 🔴 Limitations
  • Commercial use
  • Distribution
  • Modification
  • Patent use
  • Private use
  • License and copyright notice
  • State changes
  • Liability
  • Trademark use
  • Warranty


~124K SLoC