@syncropel/tokens
v0.1.0
Published
Canonical design tokens for the Syncropel platform — the source of truth for colors, typography, spacing, and motion across kernel-rendered sites, the Studio React renderer, and any future surface (TUI / MCP / mobile). EARTH MINERAL PALETTE: copper accent
Maintainers
Readme
@syncropel/tokens
Canonical design tokens for the Syncropel platform — the single source of truth for colors, typography, spacing, and motion across kernel-rendered sites, the Studio React renderer, and any future surface (TUI / MCP / mobile).
EARTH MINERAL PALETTE — copper accent, sandstone backgrounds, mineral status colors. Light + dark themes. No JavaScript runtime required for the CSS.
What this is
This package ships the canonical CSS custom-property tokens that every Syncropel rendering surface consumes. The kernel binary embeds the core.css subset at build time. The Studio React renderer (@syncropel/react) imports the full bundle. Operators publishing custom sites get the same brand expression as the platform's built-in surfaces.
Source of truth ratified in the Canonical Syncropel Design Tokens ADR (see syncropel-spec/15-decisions/).
Two layers
| Layer | Size | Contents | Consumers |
|---|---|---|---|
| core.css | ~10KB | Backgrounds, surfaces, borders, text hierarchy, accent (copper), status, code, typography (font stacks + sizes + weights + line heights + letter spacing), spacing scale (4px base), row heights, border radii, sidebar widths, content widths, shadows, transitions, opacity, scrollbar, base animations (pulse / spin / blink / fade-in). Full light + dark themes via :root and .dark / [data-theme="dark"] + prefers-color-scheme. | Kernel sites, any general consumer |
| extended.css | ~25KB | Workspace-specific colors: act colors (one per F1 act type — intend/do/know/learn/get/put/call/map), thread state colors (one per task lifecycle state), evidence tier colors. Light + dark variants. | Studio React renderer; site authors who want act/state-toned content |
Installation
npm install @syncropel/tokensUsage
Plain HTML / no bundler
<link rel="stylesheet" href="https://unpkg.com/@syncropel/tokens/core.css">
<!-- or import the bundle (core + extended): -->
<link rel="stylesheet" href="https://unpkg.com/@syncropel/tokens/styles.css">Bundler (Vite / Webpack / etc.)
// in your root index.ts or _app.tsx
import "@syncropel/tokens/core.css";
// optional: include extended (workspace) tokens
import "@syncropel/tokens/extended.css";
// or import the bundle:
import "@syncropel/tokens/styles.css";Programmatic access (TypeScript)
import {
CORE_COLOR_TOKENS,
EXTENDED_ACT_TOKENS,
tokenVar,
type CoreToken,
} from "@syncropel/tokens";
// Iterate token names
for (const name of CORE_COLOR_TOKENS) {
console.log(name); // e.g. "accent", "bg-primary", ...
}
// Get a CSS var() reference
const accent = tokenVar("accent"); // → "var(--accent)"
const intend = tokenVar("act-intend"); // → "var(--act-intend)"
// Type-safe token usage in CSS-in-JS:
const StyledButton = styled.button`
background: ${tokenVar("accent")};
color: var(--accent-text);
padding: var(--space-2) var(--space-4);
border-radius: var(--radius);
font-size: var(--text-base);
`;Theme switching
The CSS supports three modes:
- Light mode (default):
:rootselector. No additional markup needed. - Forced dark mode: add
class="dark"to<html>or<body>, ordata-theme="dark". - System preference: dark theme auto-applies via
@media (prefers-color-scheme: dark)if neither.lightnor[data-theme="light"]is set.
To force light mode (overriding system preference): class="light" or data-theme="light".
<!-- Force light -->
<html class="light"> ... </html>
<!-- Force dark -->
<html class="dark"> ... </html>
<!-- Follow system preference (default) -->
<html> ... </html>Operator overrides (white-label)
Operators can override a narrow allowlist of tokens via the tokens_override mechanism in core.site.v1. The allowlist is exposed via TOKEN_OVERRIDE_ALLOWLIST:
import { TOKEN_OVERRIDE_ALLOWLIST, isOverridableToken } from "@syncropel/tokens";
console.log(TOKEN_OVERRIDE_ALLOWLIST);
// → ["accent", "accent-hover", "accent-text", "accent-subtle",
// "bg-primary", "bg-secondary", "surface-0", "surface-1",
// "font-sans", "font-mono"]
isOverridableToken("accent"); // → true
isOverridableToken("text-primary"); // → false (intentional — protects contrast)This is enforced kernel-side at ingest validation on core.site.v1 records.
What's intentionally missing
- No utility classes — this is a token package, not a Tailwind alternative. Components live in
@syncropel/react. - No JavaScript runtime — all theming is CSS-native via custom properties.
- No font loading — the host app provides fonts via
--font-geist-sans/--font-geist-monooverrides at:root, falling back to system fonts (zero-latency). - No display/hero sizes — typography scale tops at 20px. Syncropel is a data tool, not a marketing-page generator.
Related packages
@syncropel/projections— SRP grammar (declarative UI documents)@syncropel/react— React renderer for SRP documents; consumes these tokens@syncropel/config— JSON Schema for record body kinds (includingcore.site.v1)@syncropel/renderer— Workspace hosting integration layer
Versioning
Tokens follow semver:
- PATCH (0.1.x): bug fixes, color refinements, no breaking changes
- MINOR (0.x.0): additive — new tokens, new themes
- MAJOR (x.0.0): removed or renamed tokens (rare; coordinated with a deprecation cycle)
@syncropel/react pins a compatible @syncropel/tokens minor range; the kernel build embeds whichever version is in the source tree.
License
Apache-2.0 © Syncropic, Inc.
