Skip to main content

Crate chromata

Crate chromata 

Source
Expand description

§Chromata

1000+ editor color themes as compile-time Rust constants.

Chromata provides every popular editor and terminal color theme as compile-time const data. No file parsing, no runtime allocation, no dependencies. Add chromata to your Cargo.toml, write chromata::popular::gruvbox::DARK_HARD.bg, and get a hex color at zero cost.

§Feature Flags

FeatureThemesDescription
popular (default)49Curated best themes (gruvbox, catppuccin, nord…)
base16305Base16 themes from tinted-theming/schemes
base24184Base24 themes from tinted-theming/schemes
vim464Vim colorschemes from vim-colorschemes repos
emacs102Emacs themes from emacs-themes-site
all1104All collections combined
ratatui-integrationFrom<Color> for ratatui types
egui-integrationFrom<Color> for egui types
crossterm-integrationFrom<Color> for crossterm types
iced-integrationFrom<Color> for iced types
serde-supportSerialize/deserialize themes

§Quick Start

use chromata::popular::gruvbox;

let theme = gruvbox::DARK_HARD;
println!("Background: {}", theme.bg.to_css_hex());
println!("Is dark? {}", theme.is_dark());

§Query APIs

use chromata::{find_by_name, filter_by_variant, Variant};

if let Some(theme) = find_by_name("Gruvbox Dark Hard") {
    println!("{}: {}", theme.name, theme.bg);
}
let dark_themes = filter_by_variant(Variant::Dark);

Modules§

popular
Curated collection of the most popular editor themes.
prelude
Convenience re-exports for common chromata types.

Structs§

Base16Palette
The 16 base16 palette slots.
Base24Palette
Extended base24 theme with additional accent slots.
Color
A color represented as RGB components. All values are compile-time constants with zero runtime cost.
Theme
A complete editor/terminal color theme.

Enums§

Contrast
Contrast level classification based on WCAG contrast ratio.
Variant
Dark or light theme variant.

Traits§

IntoFrameworkColor
Trait for converting a Chromata Color to a framework-specific color type.
IntoFrameworkTheme
Trait for converting an entire Chromata Theme into a framework theme.

Functions§

collect_all_themes
Collect all themes from enabled feature modules into a Vec.
filter_by_contrast
Filter all themes by contrast level.
filter_by_variant
Filter all themes by variant (Dark or Light).
find_by_name
Find a theme by exact name (case-sensitive).