7 releases (4 stable)

Uses old Rust 2015

1.1.0 Apr 5, 2020
1.0.2 Oct 24, 2018
0.2.2 Apr 4, 2018
0.1.1 Feb 27, 2018

#78 in Images

Download history 48/week @ 2021-01-15 67/week @ 2021-01-22 45/week @ 2021-01-29 34/week @ 2021-02-05 67/week @ 2021-02-12 38/week @ 2021-02-19 60/week @ 2021-02-26 21/week @ 2021-03-05 27/week @ 2021-03-12 48/week @ 2021-03-19 44/week @ 2021-03-26 61/week @ 2021-04-02 33/week @ 2021-04-09 39/week @ 2021-04-16 39/week @ 2021-04-23 34/week @ 2021-04-30

229 downloads per month
Used in tizol


4.5K SLoC


Colors and color spaces made simple, for Rustaceans.

Build Status Crates.io dependency status Documentation

Humans and computers don't view color the same way, and so color descriptions like RGB don't effectively describe colors in the way that humans perceive them and vice versa. Image processing and other disciplines require the ability to interconvert and work with colors in a way that respects both how colors are displayed and how they are perceived by the human eye. Scarlet makes this not only possible, but simple and convenient. With Scarlet, you can:

  • Interconvert between different color representations
  • Work with colors in one representation using the concepts of a different one: for example, you can use a model of color luminance that accurately models human vision without leaving RGB, or modify a color's hue in CIELAB
  • Mix and average colors accurately, without kludges or results that look wrong to humans
  • Create perceptually-uniform color scales, colormaps, and gradients suitable for publication-quality visuals that don't mislead viewers
  • Convert a color to grayscale accurately and precisely
  • Accurately determine how far apart colors are perceptually.
  • And more!


Add this to your Cargo.toml:

scarlet = "1.1.0"

and this to your crate root:

extern crate scarlet;


Consult the documentation at docs.rs.

Contributing Guidelines

Before making a pull request, please consult the contributing guidelines.

The gist of it is:

  • Running cargo test should result in all tests passing. If tests themselves are wrong, change those in the pull request and explain the errors. Don't disable tests to make cargo test pass unless you have a really good reason!
  • If you make changes to the public-facing API, you should make sure that those changes are consistent with best practices and explain why you feel the API should change.
  • If you make performance improvements to code that already works, benchmark the change with test code that does things users would want to do and publish the results showing that your improvement actually improved something.
  • If you add new functionality, you should have test cases that thoroughly test that functionality.

General Philosophy

To look at the general philosophy and API design of Scarlet, please look at api.org. This is more intended for developers.


~131K SLoC