Tokens
Tokens are CSS variables named --cs-*. Clawscale's styles read them, so one override restyles every component that uses the token.
Usage#
CSS#
@clawscale/react/styles.css declares every token of the default theme, for both color schemes. A theme stylesheet in @clawscale/react/themes/ sets its own values. Read them with var().
.queue-panel {
background: var(--cs-color-surface);
border: 1px solid var(--cs-color-border);
border-radius: var(--cs-radius-lg);
padding: var(--cs-space-4);
}Elements styled with tokens follow the theme and the color scheme. Press Shift + T or Shift + D to switch them and watch this panel.
const runs = [
{ pipeline: "orders-daily", region: "us-east-1", status: "Succeeded", failed: false },
{ pipeline: "events-hourly", region: "eu-west-1", status: "Failed", failed: true },
{ pipeline: "billing-sync", region: "ap-south-1", status: "Succeeded", failed: false },
];
const panel = {
background: "var(--cs-color-surface)",
border: "1px solid var(--cs-color-border)",
borderRadius: "var(--cs-radius-lg)",
boxShadow: "var(--cs-shadow-1)",
padding: "var(--cs-space-1) 0",
width: 340,
};
const row = { display: "flex", gap: "var(--cs-space-3)", padding: "var(--cs-space-2) var(--cs-space-4)" };
export default function TokensCustomElement() {
return (
<div style={panel}>
{runs.map((run) => (
<div key={run.pipeline} style={row}>
<span style={{ flex: 1, fontWeight: "var(--cs-font-weight-medium)" }}>{run.pipeline}</span>
<span style={{ color: "var(--cs-color-text-muted)" }}>{run.region}</span>
<span style={{ color: run.failed ? "var(--cs-color-danger-text)" : "var(--cs-color-success-text)" }}>
{run.status}
</span>
</div>
))}
</div>
);
}JavaScript#
Install @clawscale/tokens to read the values in code, for example for a canvas chart.
npm install @clawscale/tokensimport { dark, light, shared, themes } from "@clawscale/tokens";
light.color.surface; // "#FFFFFF"
dark.color.surface; // "#16171B"
shared.radius.md; // "6px"
themes.default.dark.color.surface; // the same value as dark.color.surfacelight, dark and shared are the default theme. themes holds every theme, each with shared, light, dark and sequential. light and dark hold color, shadow and chart. shared holds the groups that do not change with the color scheme. chartPalettes and sequentialBlue hold chart colors. themeVariables(theme, colorScheme) and sharedVariables(theme) return the values keyed by variable name, such as "--cs-radius-md".
Without Clawscale styles#
@clawscale/tokens/tokens.css declares the default theme's variables alone, outside any cascade layer. The dark values apply under [data-cs-color-scheme="dark"]. A theme other than the default ships @clawscale/tokens/themes/<name>.css, which applies under [data-cs-theme="<name>"]. Use them on pages that do not load @clawscale/react/styles.css. @clawscale/tokens/tokens.json holds the same values for other tools.
@import "@clawscale/tokens/tokens.css";Override a token#
Set the variable in your own CSS. Unlayered CSS beats both Clawscale layers, so you never need !important.
:root {
--cs-radius-md: 4px;
--cs-color-primary-text-light: #0b6b5c;
--cs-color-primary-text-dark: #4fd1b8;
}Color, shadow and chart tokens have a light and a dark value, such as --cs-color-primary-text-light and --cs-color-primary-text-dark. Set both, and each color scheme picks its own. Theming covers brand colors and scoped overrides.
The tables below list the default theme.
Reference#
Color#
Surfaces, borders, text, controls and intents. Colors shows them as swatches.
| Token | Light | Dark |
|---|---|---|
--cs-color-canvas | #F4F5F7 | #0F1013 |
--cs-color-surface | #FFFFFF | #16171B |
--cs-color-surface-raised | #FFFFFF | #1D1F24 |
--cs-color-surface-sunken | #F6F7F9 | #121316 |
--cs-color-surface-hover | rgba(20, 24, 31, 0.05) | rgba(255, 255, 255, 0.06) |
--cs-color-surface-active | rgba(20, 24, 31, 0.09) | rgba(255, 255, 255, 0.10) |
--cs-color-surface-selected | rgba(53, 99, 233, 0.10) | rgba(99, 136, 255, 0.18) |
--cs-color-border | #E3E6EA | #2A2D33 |
--cs-color-border-strong | #CDD2D9 | #3A3E46 |
--cs-color-border-subtle | #ECEEF1 | #212328 |
--cs-color-text | #1A1C21 | #E7E9EC |
--cs-color-text-muted | #555D6A | #A3AAB4 |
--cs-color-text-subtle | #666F7C | #858D99 |
--cs-color-text-disabled | #9AA1AC | #5E6570 |
--cs-color-text-inverse | #FFFFFF | #0F1013 |
--cs-color-focus | #3563E9 | #7C9CFF |
--cs-color-backdrop | rgba(15, 16, 19, 0.42) | rgba(0, 0, 0, 0.62) |
--cs-color-selection | rgba(53, 99, 233, 0.20) | rgba(124, 156, 255, 0.32) |
--cs-color-tooltip | #1F2228 | #2C2F36 |
--cs-color-tooltip-text | #F4F5F7 | #F4F5F7 |
--cs-color-control | #FFFFFF | #1F2127 |
--cs-color-control-hover | #F6F7F9 | #262930 |
--cs-color-control-active | #EDEFF2 | #2D3139 |
--cs-color-control-border | #CDD2D9 | #363A42 |
--cs-color-control-border-hover | #B7BEC8 | #464B55 |
--cs-color-neutral | #5F6875 | #555C68 |
--cs-color-neutral-hover | #4C5460 | #626A77 |
--cs-color-neutral-active | #3E454F | #6E7684 |
--cs-color-neutral-on | #FFFFFF | #FFFFFF |
--cs-color-primary | #3563E9 | #3563E9 |
--cs-color-primary-hover | #2B55D6 | #2B55D6 |
--cs-color-primary-active | #2448BD | #2448BD |
--cs-color-primary-disabled | #9DB5F4 | #2C3F75 |
--cs-color-primary-on | #FFFFFF | #FFFFFF |
--cs-color-primary-subtle | #EEF3FF | rgba(92, 130, 255, 0.16) |
--cs-color-primary-subtle-hover | #E0E9FF | rgba(92, 130, 255, 0.24) |
--cs-color-primary-border | #B8CBFA | rgba(124, 156, 255, 0.45) |
--cs-color-primary-text | #2B55D6 | #8AA8FF |
--cs-color-success | #1B7F4E | #1B7F4E |
--cs-color-success-hover | #176E43 | #176E43 |
--cs-color-success-active | #135D39 | #135D39 |
--cs-color-success-disabled | #8CC4A7 | #1F4A36 |
--cs-color-success-on | #FFFFFF | #FFFFFF |
--cs-color-success-subtle | #E9F6EF | rgba(46, 184, 120, 0.15) |
--cs-color-success-subtle-hover | #D9EFE3 | rgba(46, 184, 120, 0.22) |
--cs-color-success-border | #A8D8BD | rgba(76, 195, 138, 0.45) |
--cs-color-success-text | #17744A | #4CC38A |
--cs-color-warning | #F5A524 | #F5A524 |
--cs-color-warning-hover | #E8971A | #E8971A |
--cs-color-warning-active | #D48712 | #D48712 |
--cs-color-warning-disabled | #F9D291 | #5C4518 |
--cs-color-warning-on | #1A1C21 | #1A1C21 |
--cs-color-warning-subtle | #FEF6E5 | rgba(245, 165, 36, 0.14) |
--cs-color-warning-subtle-hover | #FCEBC6 | rgba(245, 165, 36, 0.22) |
--cs-color-warning-border | #F2CD84 | rgba(245, 181, 74, 0.45) |
--cs-color-warning-text | #9A5A00 | #F5B54A |
--cs-color-danger | #D23535 | #D23535 |
--cs-color-danger-hover | #BD2D2D | #BD2D2D |
--cs-color-danger-active | #A42626 | #A42626 |
--cs-color-danger-disabled | #E89A9A | #5A2426 |
--cs-color-danger-on | #FFFFFF | #FFFFFF |
--cs-color-danger-subtle | #FDEEEE | rgba(255, 99, 99, 0.14) |
--cs-color-danger-subtle-hover | #FADBDB | rgba(255, 99, 99, 0.22) |
--cs-color-danger-border | #F1B0B0 | rgba(255, 122, 122, 0.45) |
--cs-color-danger-text | #B42A2A | #FF8585 |
Shadow#
0 to 4 are elevation levels. control sits under buttons and inputs.
| Token | Light | Dark |
|---|---|---|
--cs-shadow-0 | 0 0 0 1px rgba(17, 20, 26, 0.08) | 0 0 0 1px rgba(255, 255, 255, 0.07) |
--cs-shadow-1 | 0 0 0 1px rgba(17, 20, 26, 0.07), 0 1px 2px rgba(17, 20, 26, 0.06) | 0 0 0 1px rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.40) |
--cs-shadow-2 | 0 0 0 1px rgba(17, 20, 26, 0.07), 0 2px 4px -1px rgba(17, 20, 26, 0.06), 0 4px 12px -2px rgba(17, 20, 26, 0.08) | 0 0 0 1px rgba(255, 255, 255, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.40), 0 4px 12px -2px rgba(0, 0, 0, 0.45) |
--cs-shadow-3 | 0 0 0 1px rgba(17, 20, 26, 0.07), 0 4px 8px -2px rgba(17, 20, 26, 0.08), 0 12px 28px -6px rgba(17, 20, 26, 0.14) | 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.45), 0 12px 28px -6px rgba(0, 0, 0, 0.55) |
--cs-shadow-4 | 0 0 0 1px rgba(17, 20, 26, 0.07), 0 8px 16px -4px rgba(17, 20, 26, 0.10), 0 28px 56px -12px rgba(17, 20, 26, 0.22) | 0 0 0 1px rgba(255, 255, 255, 0.09), 0 8px 16px -4px rgba(0, 0, 0, 0.50), 0 28px 56px -12px rgba(0, 0, 0, 0.65) |
--cs-shadow-control | 0 1px 2px rgba(17, 20, 26, 0.06) | 0 1px 2px rgba(0, 0, 0, 0.35) |
Chart#
Slots 1 to 8 are the categorical palette, in fixed order. grid and axis draw chart chrome. The status colors are the same in every theme and color scheme.
| Token | Light | Dark |
|---|---|---|
--cs-chart-1 | #3563E9 | #4A74F0 |
--cs-chart-2 | #EB6834 | #D95926 |
--cs-chart-3 | #1BAF7A | #199E70 |
--cs-chart-4 | #EDA100 | #C98500 |
--cs-chart-5 | #E87BA4 | #D55181 |
--cs-chart-6 | #008300 | #008300 |
--cs-chart-7 | #4A3AA7 | #9085E9 |
--cs-chart-8 | #E34948 | #E66767 |
--cs-chart-grid | #E3E6EA | #26292E |
--cs-chart-axis | #BCC2CA | #3A3E46 |
--cs-chart-good | #0CA30C | #0CA30C |
--cs-chart-warning | #FAB219 | #FAB219 |
--cs-chart-serious | #EC835A | #EC835A |
--cs-chart-critical | #D03B3B | #D03B3B |
The sequential ramp shows magnitude, such as heatmap cells. The lightest step means near zero. It is the same in both color schemes.
| Token | Value |
|---|---|
--cs-chart-seq-100 | #CDE2FB |
--cs-chart-seq-200 | #9EC5F4 |
--cs-chart-seq-300 | #6DA7EC |
--cs-chart-seq-400 | #3987E5 |
--cs-chart-seq-500 | #256ABF |
--cs-chart-seq-600 | #184F95 |
--cs-chart-seq-700 | #0D366B |
Font#
Font stacks. @clawscale/react/fonts.css loads the first family of each.
| Token | Value | Preview |
|---|---|---|
--cs-font-sans | "Inter Variable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif | Rows 12,480 |
--cs-font-mono | "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace | Rows 12,480 |
Font size#
The type scale. Body text uses md.
| Token | Value | Preview |
|---|---|---|
--cs-font-size-xs | 11px | Rows 12,480 |
--cs-font-size-sm | 12px | Rows 12,480 |
--cs-font-size-md | 13px | Rows 12,480 |
--cs-font-size-lg | 15px | Rows 12,480 |
--cs-font-size-xl | 18px | Rows 12,480 |
--cs-font-size-2xl | 22px | Rows 12,480 |
--cs-font-size-3xl | 28px | Rows 12,480 |
--cs-font-size-4xl | 36px | Rows 12,480 |
Font weight#
| Token | Value | Preview |
|---|---|---|
--cs-font-weight-regular | 400 | Rows 12,480 |
--cs-font-weight-medium | 500 | Rows 12,480 |
--cs-font-weight-semibold | 600 | Rows 12,480 |
--cs-font-weight-bold | 700 | Rows 12,480 |
Line height#
| Token | Value |
|---|---|
--cs-line-height-tight | 1.25 |
--cs-line-height-normal | 1.4 |
--cs-line-height-relaxed | 1.6 |
Radius#
| Token | Value | Preview |
|---|---|---|
--cs-radius-xs | 2px | |
--cs-radius-sm | 4px | |
--cs-radius-md | 6px | |
--cs-radius-lg | 8px | |
--cs-radius-xl | 12px | |
--cs-radius-full | 9999px |
Space#
A 4px grid. Use it for padding, margins and gaps.
| Token | Value | Preview |
|---|---|---|
--cs-space-1 | 4px | |
--cs-space-2 | 8px | |
--cs-space-3 | 12px | |
--cs-space-4 | 16px | |
--cs-space-5 | 20px | |
--cs-space-6 | 24px | |
--cs-space-8 | 32px | |
--cs-space-10 | 40px | |
--cs-space-unit | 4px |
Corner#
The CSS corner-shape of rounded corners: round, or bevel to cut them where the browser supports it.
| Token | Value |
|---|---|
--cs-corner-shape | round |
Label#
How short labels look: buttons, tabs, column headers and section titles. Text that shows data never takes these.
| Token | Value |
|---|---|
--cs-label-transform | none |
--cs-label-tracking | normal |
Control height#
The heights of Blueprint's small, medium and large buttons and inputs. Use them to size your own controls to match.
| Token | Value | Preview |
|---|---|---|
--cs-control-height-sm | 24px | |
--cs-control-height-md | 30px | |
--cs-control-height-lg | 40px |
Duration#
| Token | Value |
|---|---|
--cs-duration-fast | 100ms |
--cs-duration-normal | 160ms |
--cs-duration-slow | 240ms |
Ease#
| Token | Value |
|---|---|
--cs-ease-standard | cubic-bezier(0.2, 0, 0, 1) |
--cs-ease-out | cubic-bezier(0, 0, 0.2, 1) |