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, one dependency (libm for no_std math). 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
bevy-color-integrationFrom<Color> for bevy_color types
colored-integrationFrom<Color> for colored types
comfy-table-integrationFrom<Color> for comfy-table types
crossterm-integrationFrom<Color> for crossterm types
cursive-integrationFrom<Color> for cursive types
egui-integrationFrom<Color> for egui types
iced-integrationFrom<Color> for iced types
image-integrationFrom<Color> for image types
macroquad-integrationFrom<Color> for macroquad types
owo-colors-integrationFrom<Color> for owo-colors types
palette-integrationFrom<Color> for palette types
plotters-integrationFrom<Color> for plotters types
ratatui-integrationFrom<Color> for ratatui types
slint-integrationFrom<Color> for slint types
syntect-integrationFrom<Color> for syntect types
termion-integrationFrom<Color> for termion types
tiny-skia-integrationFrom<Color> for tiny-skia types
wgpu-integrationFrom<Color> for wgpu types
serde-supportSerialize + Deserialize for themes

§Core Types

  • Color — RGB color with hex conversion, WCAG luminance, contrast ratio, lerp
  • Theme — 29 color fields + metadata (name, author, variant, contrast)
  • ThemeBuilder — Fluent builder for constructing themes at runtime
  • VariantDark or Light
  • ContrastHigh, Normal, or Low (WCAG-based)
  • Base16Palette — The 16 base16 palette slots (used within Base24Palette)
  • Base24Palette — Extended 24-slot palette (exported by base24 themes as PALETTE)

§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§

base16base16
Base16 color themes.
base24base24
Base24 color themes.
emacsemacs
Emacs color themes.
popularpopular
Curated collection of the most popular editor themes.
prelude
Convenience re-exports for common chromata types.
vimvim
Vim color themes.

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.
ParseColorError
Error returned when parsing a Color from a string fails.
ParseContrastError
Error returned when parsing a Contrast from a string fails.
ParseVariantError
Error returned when parsing a Variant from a string fails.
Theme
A complete editor/terminal color theme.
ThemeBuilder
Builder for constructing Theme values at runtime.

Enums§

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

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