#color #colors #colour #css #converter

color_processing

A library to handle colors easyly. It can parse a string in several formats (hex, rgb, cmyk, hwb, …) into the Color-struct, modifying (grayscale, colorize, …) and output into several string formats.

9 releases

✓ Uses Rust 2018 edition

0.3.1 May 2, 2019
0.3.0 Apr 7, 2019
0.2.2 Mar 9, 2019
0.2.1 Feb 12, 2019
0.1.2 Nov 25, 2018

#60 in GUI

Download history 32/week @ 2019-03-22 2/week @ 2019-03-29 21/week @ 2019-04-05 8/week @ 2019-04-12 13/week @ 2019-04-19 7/week @ 2019-04-26 11/week @ 2019-05-03 24/week @ 2019-05-10 33/week @ 2019-05-17 20/week @ 2019-05-24 1/week @ 2019-05-31 46/week @ 2019-06-07 1/week @ 2019-06-14 55/week @ 2019-06-21 28/week @ 2019-06-28

70 downloads per month
Used in 1 crate

CC0 license

132KB
2.5K SLoC

Purpose

This rust library is intended to do some processing of color values.
It can parse strings in different formats (known color names, hex, rgb, cmyk, hsl, ...) and output color values in different formats. It can also do some basic modifications, like grayscale and colorization.

This library cannot modify images.

Usage

To use color_processing, first add this to your Cargo.toml:

[dependencies]
color_processing = "0.3"

Next, add this to your crate:

extern crate color_processing;

use color_processing::Color;

fn main() {
    let red = Color::new_string("red").unwrap();
    assert_eq!("#FF0000", red.to_hex_string());

    let green = Color::new_string("rgb(0, 255, 0)").unwrap();
    assert_eq!("#00FF00", green.to_hex_string());

    let blue = Color::new_rgb(0, 0, 255);
    assert_eq!("rgb(0, 0, 255)", blue.to_rgb_string());

    // ...
}

Documentation

For the latest documentation and examples, please go to https://docs.rs/color_processing.

Miscellaneous

If you have suggestions or found an error, feel free to open an issue or create a pull request on github.

Dependencies

~2MB
~32K SLoC