rusty_tokens is an open-source design-token toolkit for any Rust UI -- semantic CSS custom-property names + neutral default values + an optional
:rootsheet emitter -- pure Rust. By default installsrusty_alloc(opt out below). Sibling ofrusty_symbolsandrusty_a11y.
Status -- v0.2.0. Pin
rusty_tokens = "0.2"from crates.io (or git tagv0.2.0). Core isno_std/ wasm-checked. Featurecssneedsalloc.
One theme contract. Token names are the CSS API (
--rt-color-fg). Defaults are a small ASCII starter; apps override via CSS. Optionalcss::root_sheet()injects a full:rootblock into WebView / Dioxus.
| Dimension | Scattered hex/rem | rusty_tokens | Goal |
|---|---|---|---|
| Naming | ad-hoc | semantic modules | maintain |
| CSS contract | none | --rt-* custom properties |
uniform |
| Defaults | copy-paste | neutral ASCII starter | portable |
| WebView inject | hand-written CSS | css::root_sheet |
opt-in |
| Allocator | system / C | rusty_alloc by default |
opt-out |
| Dependencies | -- | none when opted out | maintain |
| License | mixed | MIT | -- |
rusty_tokens = "0.2"
# bring your own allocator:
# rusty_tokens = { version = "0.2", default-features = false }
# CSS :root emitter:
# rusty_tokens = { version = "0.2", features = ["css"] }
# hardened:
# rusty_tokens = { version = "0.2", features = ["secure"] }| Feature | Default | Provides |
|---|---|---|
rusty-alloc |
yes | rusty_alloc via rusty_alloc_default |
secure |
no | enables rusty-alloc + hardening |
| (core) | -- | color / space / type_scale / radius consts |
css |
no | css::root_sheet |
Always on: pure-ASCII source, no_std core. Combining with sibling crate defaults is safe (shared allocator seam).
MSRV: 1.73.
use rusty_tokens::color;
fn fg_var() -> &'static str {
color::FG // "--rt-color-fg"
}
fn fg_default() -> &'static str {
color::FG_VALUE // "#1a1a1a"
}// feature = "css"
use rusty_tokens::css;
fn inject_theme() -> String {
css::root_sheet()
}cargo test
cargo test --features css- color -- fg / bg / muted / accent / success / danger / warn / border (+
_VALUE). - space -- xs / sm / md / lg / xl rem steps.
- type_scale -- caption / body / title / display sizes.
- radius -- sm / md / lg corner radii.
- css --
:rootsheet emitter (cssfeature). - Guards -- ASCII source self-test; value contract tests.
| Capability | Status |
|---|---|
Semantic token name consts (--rt-*) |
done |
| Neutral default values (hex / rem) | done |
CSS :root emitter |
done feature css |
| ASCII self-test | done |
no_std + wasm |
done (css needs alloc) |
| crates.io | done v0.1.0 |
┌──────────────────────────────────────────────────────────┐
│ rusty_tokens │
│ │
│ color / space / type_scale / radius ✅ │
│ css::root_sheet [feature css] ✅ │
└──────────────────────────────────────────────────────────┘
Northern star: one CSS custom-property contract apps can override without rewriting Rust. Sibling glyph toolkit: thoth.
| Platform | Status |
|---|---|
| Windows | yes |
| macOS | yes |
| Linux | yes |
| Web (Dioxus / browsers) | yes |
WASM (wasm32-unknown-unknown) |
yes (no_std core; css needs alloc) |
No OS APIs. Inject root_sheet() into WebView / Dioxus document head; override
any --rt-* property afterward.
Remade With Rust (Mata Network) rebuilds essential tooling in Rust -- memory safety, predictable performance, permissive license.
-> github.com/remade-with-rust
Family: thoth · rusty_tokens · rusty_a11y
MIT -- LICENSE-MIT.
"Remade With Rust", "Mata", and "Mata Network" are marks of Mata Network.