Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rusty_tokens

Remade With Rust By Mata Network License: MIT Platforms: Windows · macOS · Linux · Web · WASM MSRV: 1.73

rusty_tokens is an open-source design-token toolkit for any Rust UI -- semantic CSS custom-property names + neutral default values + an optional :root sheet emitter -- pure Rust. By default installs rusty_alloc (opt out below). Sibling of rusty_symbols and rusty_a11y.

Status -- v0.2.0. Pin rusty_tokens = "0.2" from crates.io (or git tag v0.2.0). Core is no_std / wasm-checked. Feature css needs alloc.


The headline

One theme contract. Token names are the CSS API (--rt-color-fg). Defaults are a small ASCII starter; apps override via CSS. Optional css::root_sheet() injects a full :root block 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 --

Install

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.

Quick start

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

Features

  • 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 -- :root sheet emitter (css feature).
  • Guards -- ASCII source self-test; value contract tests.

Capability table

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

Architecture

┌──────────────────────────────────────────────────────────┐
│  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 support

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

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

License

MIT -- LICENSE-MIT.

Trademark

"Remade With Rust", "Mata", and "Mata Network" are marks of Mata Network.

About

Design tokens for Rust UIs — semantic CSS vars + neutral defaults (Remade With Rust)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages