#color-palette #json #color #file

simple-color-palette

A Rust implementation of the Simple Color Palette format

1 unstable release

Uses new Rust 2024

0.1.0 Apr 18, 2025

#606 in Parser implementations

Download history 137/week @ 2025-04-16 4/week @ 2025-04-23

141 downloads per month

MIT license

22KB
425 lines

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);

Dependencies

~0.6–1.5MB
~32K SLoC