Crates.io | colourado |
lib.rs | colourado |
version | 0.2.0 |
source | src |
created_at | 2019-01-25 03:44:17.111659 |
updated_at | 2019-01-26 15:26:32.630846 |
description | A small and minimalistic library to generate a random color palette |
homepage | |
repository | https://github.com/BrandtM/colourado |
max_upload_size | |
id | 110557 |
size | 14,786 |
A small and minimalistic library to generate a random color palette.
The user-facing Color
struct contains RGB colors ranging from 0 to 1.
All colors are of type f32 (no exceptions).
use colourado::{Color, ColorPalette, PaletteType};
let palette = ColorPalette::new(4, PaletteType::Random, false);
let random_color = palette.colors[0].red;
let color_array: [f32; 3] = palette.colors[1].to_array();
let hue = 315.0;
let saturation = 0.5;
let value = 0.3;
let rgb_color: Color = Color::hsv_to_rgb(hue, saturation, value);
A color palette might look like this when rendered:
Test the color palettes for yourself by running
cargo run --example preview TYPE NUM adjacent|spread
TYPE
can be one of random, pastel, or dark
NUM
is the amount of colors to generate and display
adjacent
or spread
determine whether the colors are generated close to each other or spread apart.