| Crates.io | simple-color-palette |
| lib.rs | simple-color-palette |
| version | 0.1.0 |
| created_at | 2025-04-18 11:44:43.345503+00 |
| updated_at | 2025-04-18 11:44:43.345503+00 |
| description | A Rust implementation of the Simple Color Palette format |
| homepage | |
| repository | https://github.com/simple-color-palette/rust-package |
| max_upload_size | |
| id | 1639262 |
| size | 29,756 |
A Rust implementation of the Simple Color Palette format — a minimal JSON-based file format for defining color palettes
Feedback wanted on the API.
Add to your Cargo.toml:
[dependencies]
simple-color-palette = "0.1.0"
use simple_color_palette::{ColorPalette, Color};
let palette = ColorPalette::new(
vec![
Color::new(1.0, 0.0, 0.0, None, Some("Red".into())),
Color::new(0.0, 1.0, 0.0, None, Some("Green".into())),
],
Some("Traffic Lights".into()),
);
let path = std::path::Path::new("Traffic Lights.color-palette");
// Save palette
palette.write_to_file(path);
// Load palette
let loaded = ColorPalette::read_from_file(path);