softy-ui-tokens
v1.4.0
Published
Design tokens for Softy UI — single source of truth for colors, typography, spacing, and radius across 50+ apps.
Readme
softy-ui-tokens
Design tokens for the Softy UI family — single source of truth for colors, typography, spacing, and radius across softy-ui and every app built on it (softyerp, softy-crm, softy-hr, …).
Install
npm install softy-ui-tokens softy-uiQuick start
/* your app's root stylesheet */
@import "softy-ui-tokens/tokens.css"; /* colors + typography variables */
@import "softy-ui/styles.css"; /* component styles */Swap themes with one attribute
Preset themes (Purple / Blue / Green / Rose / Orange) are available via data-theme:
@import "softy-ui-tokens/themes/blue.css";<html data-theme="blue">Every component reading var(--primary) recolors instantly.
Runtime customization
import { applyTheme, setColor, resetTheme, getColor } from "softy-ui-tokens";
applyTheme("green"); // switch to a preset
setColor("primary", "#ff0080"); // or pick a custom color
setColor("ring", "#ff0080");
resetTheme(); // back to defaults
console.log(getColor("primary")); // read currently-applied valueAll changes are instant — no re-render, no rebuild.
Per-app brand override
/* apps/softy-crm/styles.css */
@import "softy-ui-tokens/tokens.css";
:root { --primary: #2563eb; --ring: #2563eb; }What's inside
| Entry | Purpose |
|---|---|
| ./tokens.css | :root + .dark CSS variables (colors, typography, radius) |
| ./themes/default.css | Purple preset (same as tokens.css) |
| ./themes/blue.css | Blue preset |
| ./themes/green.css | Green preset |
| ./themes/rose.css | Rose preset |
| ./themes/orange.css | Orange preset |
| ./tokens.json | W3C DTCG token file (for Figma/Style Dictionary sync) |
| . (JS) | TypeScript runtime helpers + typed color values |
Figma
tokens.json follows the W3C DTCG format and is compatible with:
- Tokens Studio for Figma — edit in Figma, push to Git
- Style Dictionary — transform into iOS / Android / other platforms
Design principles
- Single source of truth — don't hard-code colors in components.
- Reference, don't duplicate — components use
var(--primary), never#7f56d9. - CSS variables everywhere — themable at runtime without re-rendering.
- Semantic names —
--primary, not--purple-500.
