simple-color-palette

Crates.iosimple-color-palette
lib.rssimple-color-palette
version0.1.0
created_at2025-04-18 11:44:43.345503+00
updated_at2025-04-18 11:44:43.345503+00
descriptionA Rust implementation of the Simple Color Palette format
homepage
repositoryhttps://github.com/simple-color-palette/rust-package
max_upload_size
id1639262
size29,756
Sindre Sorhus (sindresorhus)

documentation

README

simple-color-palette

A Rust implementation of the Simple Color Palette format — a minimal JSON-based file format for defining color palettes

Feedback wanted on the API.

Install

Add to your Cargo.toml:

[dependencies]
simple-color-palette = "0.1.0"

Usage

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);
Commit count: 2

cargo fmt