#color-palette #palette #color

color-palettes

Generate colors in a perceptually uniform color space

1 unstable release

0.1.0 Oct 7, 2024

#19 in #palette

Download history 134/week @ 2024-10-02 55/week @ 2024-10-09 11/week @ 2024-10-16

200 downloads per month

MIT license

20KB
475 lines

Color Palettes

Generate colors with a perceptually uniform distance between them.

use color_palettes::*;

fn main() {
    let num_colors = 16;
    let config = GeneratorConfig::default();
    let palette = generate_palette(num_colors, &config).unwrap();
    save_palette(&palette, "palette.png");
}

You can adjust the distance between subsequent colors in the palette by changing similarity:

    let mut config = GeneratorConfig::default();
    config.similarity = 0.8; // takes values between 0 and 1
    let palette = generate_palette(num_colors, &config).unwrap();

Dependencies

~5.5–7.5MB
~125K SLoC