#color-palette #themes #no-alloc #hex-string

no-std base16-palettes

A representation of the Base16 palettes in Rust

1 unstable release

0.1.0 Jan 16, 2024

#152 in No standard library


Used in webatui

MIT/Apache

78KB
4K SLoC

Crates.io Documentation GitHub Workflows

About

This is a simple crate that encodes all of the Base16 palettes into Rust code. A color is encoded in a universal representation that is then intrepretted into RGB and hex representation through a palette.

Contributing

The currently supported palettes are those that are in the base16 repo's README. A few of the listed themes are unavailable. If you would like to have support added for your favorite missing theme, open an issue or PR.


lib.rs:

This crate contains representations of all of the major Base16 themes. Color representation is split into two parts, the universal base 16 color and the palette. A color is represented by a Base16Color, which is then rendered into either a RGB tuple of u8s or into a hex string.

Each collection of themes is gated by a feature flag to minimize the number of palettes you have to compile.

Lastly, this crate is fully no_std.

Dependencies

~0.4–0.9MB
~20K SLoC