Skip to content
OAIT Design System

Design system / Foundations

Tokens

One source file holds every token of the OAIT Design System, and one script turns it into the formats each stack and tool reads. Look values up in the token reference; this guide explains the files, the pipeline, and how to change a token.

The pipeline

tokens.source.json  →  node build.mjs  →  oait.css             CSS custom properties
(the only source;                         tailwind.css         Tailwind CSS v4
 FORMAT.md describes it)                  tailwind.preset.cjs  Tailwind CSS v3
                                          shadcn.css           the shadcn/ui bridge
                                          oait.tokens.json     W3C Design Tokens (DTCG)
                                          artifact.tokens.json the Design System artifact
                                          tokens.md            the token reference
                                          contrast.md          the contrast report
  • One source. tokens.source.json holds 334 tokens, their usage notes, the Tamakkan accent block, the contrast rules, and the shadcn/ui map. Its shape is in FORMAT.md.
  • One generator. build.mjs needs Node 18 or later and nothing else, and it finds its own folder, so it runs from anywhere: node tokens/build.mjs from the package root.
  • Eight outputs. The six text files open with the line "OAIT Design System 2.1.0 — generated from tokens.source.json by build.mjs. Do not edit by hand." (tokens.md and contrast.md just under their title); oait.tokens.json names the version in its $description, and artifact.tokens.json carries only the system's name. Never edit any of them: the next build overwrites them. The same source always gives the same bytes, so a diff of the outputs shows exactly what a source change does.
Command Writes the eight files Exit code
node build.mjs yes 1 on a source problem; otherwise 0, with any contrast failure printed
node build.mjs --check yes, before it reports 1 on a source problem (nothing written); 2 on any contrast failure that is not declared; 0 when everything passes

A source problem is anything the build validates: a name that is not kebab-case, a token without a usage note, a color that is neither lowercase hex nor an alias, an alias to a missing token, a duplicate name, two tokens of a color.equal group that differ, or a contrast rule, override, keyframe, variant, or shadcn radius that names something missing.

The files

File What it holds Who uses it How to load it
tokens.source.json The source whoever changes a token edit only this file
build.mjs The generator whoever changes a token node build.mjs --check
FORMAT.md The source format, field by field whoever changes a token
oait.css Every token as a CSS custom property: light on :root; dark under the system setting, data-theme="dark", or .dark; the :lang(ar) type block; the motion keyframes; and the Tamakkan block plain CSS products (Global Games, Tamakkan), the reference pages, and Tailwind v3 products the first stylesheet of the page
tailwind.css Tailwind CSS v4: an @theme block that switches Tailwind's palette off and defines one utility per token, followed by the same variables, theme switches, Arabic block, keyframes, and accent block as oait.css, and the dark: and short: variants Tailwind v4 products (oait.app, Global ID, Global Jobs) @import "tailwindcss"; then @import "<ds>/tokens/tailwind.css";. It declares every variable oait.css declares, so a Tailwind v4 product never needs oait.css as well
shadcn.css shadcn/ui's variables (--background, --primary, --ring, and the rest) with the system's values in light and dark, the @theme inline bridge, the re-bound secondary, and the shadcn radius scale shadcn/ui products (Global Jobs) and the AI tools that generate shadcn/ui after tailwind.css, never alone, never with data-product
tailwind.preset.cjs A Tailwind CSS v3 preset whose colors, type styles, and other scales read the oait.css variables Tailwind v3 projects presets: [require('<ds>/tokens/tailwind.preset.cjs')], with oait.css loaded first
oait.tokens.json W3C Design Tokens (DTCG) JSON. Dark and product values sit in $extensions["app.oait.modes"], the Arabic overrides in "app.oait.overrides", and the keyframes in "app.oait.keyframes" design tools that read DTCG
artifact.tokens.json The tokens as lists, in four themes: light, dark, and the Tamakkan accent over each the Design System artifact
tokens.md Every token: CSS name, Tailwind utility, light and dark values, and usage note everyone, and AI tools as context
contrast.md Every declared text and background pair in light, in dark, and under the Tamakkan accent, with its ratio reviewers of a token change

Load orders

Stack Order
Plain CSS and Vite oait.css → reference/oait-ui.css → the page's styles
Tailwind CSS v4 tailwindcss → tailwind.css → reference/css/base.css in layer(base)
shadcn/ui tailwindcss → tailwind.css → shadcn.css → reference/css/base.css in layer(base)
Tailwind CSS v3 oait.css → tailwindcss/base → reference/css/base.css → tailwindcss/components → tailwindcss/utilities, all as @import (through postcss-import), with the preset in the config. base.css after the preflight, never before it

The README quick start shows each one in full (canonical §0.5, D-COL-22, D-ARC-19).

What switches the values

Set Where Effect
nothing light; dark when the system setting is dark
data-theme="light" or class light <html> always light
data-theme="dark" or class dark <html> always dark
data-product="tamakkan" <html> on Tamakkan's pages; on a family page, only Tamakkan's own mark or lock-up element the seven accent tokens take Tamakkan's values in that subtree, and mark-accent follows them. It never themes a family product (R-71)
lang="ar" <html> or any element the Arabic type block: the same sizes, with taller line heights, no tracking, and a 13px eyebrow; code-*, numeral-*, and the three lockup-name* styles keep their values

Themes switch on <html> only; a subtree never changes theme. Components never write @media (prefers-color-scheme) or dark: color variants (canonical §0.5, D-COL-14, D-ARC-07, D-TYP-14).

Add or change a token

  1. Find the owner. Token names and values belong to the family's owner: color owns colors, accents, contrast rules, opacities, and the shadcn map; typography owns fonts and type; layout owns spacing, sizes, z-index, breakpoints, and containers; and shape, elevation, and motion own radius, shadow, duration, easing, and animation. A component picks tokens within the owner's usage rule, and a measured reason beats both (D-ARC-01).
  2. Check that it is needed. Look for an existing token or a recipe first. A request that an owner's rule already covers becomes a recipe or a rename, not a new token (D-ARC-01). Never add a name canonical lists as not adopted, such as surface-dim, primary-hover, or selected-row (canonical §2.1).
  3. Edit the source. Add the token to its family in tokens.source.json with a name, a value (light and dark for a color; a color may alias another as "{name}"), and a usage note of one or two sentences that says where it is used and, for a text color, on which grounds it is legible. A text, icon, edge, or ring color also needs its pairs in contrast: { "fg": "<text>", "bg": ["<ground>", …], "min": 4.5 }, with 3 for control edges, focus rings, and chart marks.
  4. Build. Run node build.mjs --check until it exits 0, then read the diff of the eight files and the new rows of contrast.md.
  5. Write it down. Update the pages that use the token, add a CHANGELOG entry, and raise the version: a new token is a minor version, and a renamed or removed one is a major version (Versioning).

For an endorsed brand's accent, add a products entry with light and dark values for exactly the seven slot tokens (primary, on-primary, primary-container, on-primary-container, primary-ink, inverse-primary, and focus-ring) and nothing else. The build declares the dependent aliases again inside the product block and checks every pair the accent touches. A new endorsed brand exists only by client decision (canonical §1.1, §2.10, D-COL-15).

The contrast gate

node build.mjs --check is the contrast gate. In 1.0.0 it checks 57 rules, 564 pairs, in light, in dark, and under the Tamakkan accent in both themes, and finds 0 failures; the contrast report lists every pair (D-COL-23, V-6).

Pair Minimum
Text and icons on every ground they may sit on 4.5:1
Control edges, focus rings, and chart marks 3:1
  • Under an accent, a pair is checked when the product changes its text or one of its grounds, directly or through an alias. A pair that cannot exist under an accent carries "products": false and says why in its note.
  • No waivers. The format allows knownFailure, but 1.0.0 uses none: a new pair that fails is fixed, not waived.
  • Equal tokens. color.equal asserts that info equals secondary and on-info equals on-secondary in every theme; a difference stops the build (D-COL-09).
  • Beyond the gate. Composites cannot be declared, so canonical measures them: primary-ink under an 8% hover layer keeps 4.53:1 or more everywhere, header glass over the inverse band keeps on-surface-variant at 6.12:1, and a selected row keeps it at 8.64:1. Pressed composites, disabled content, the orange fill's edge against the page, decorative hairlines, and art hidden from screen readers are accepted (canonical §2.13).
  • Large text means 24px and up only (headline-sm and larger, and the hero, display, and numeral styles); title-md at 18px bold still needs 4.5:1.

Naming rules

  • Names are lowercase kebab-case, ^[a-z0-9][a-z0-9-]{0,62}$, unique within their family. Every token has a usage note.
  • Colors are lowercase hex (#rrggbb, or #rrggbbaa for translucency) or an alias, "{other-name}".
  • Roles, then palette. Colors use Material 3 role names in two layers: palette tokens (pastel-*, cat-*, passport-*, and chart-*) and role tokens that alias them (primary-container → pastel-peach). Write the role, never its target (canonical §2.1, D-COL-01).
  • Status names are aliases: success* → tertiary*; info holds its own value, asserted equal to secondary.
  • Product ids follow the brand spelling: tamakkan, in data-product and in passport-tamakkan-* (D-BCP-04).
  • The traps. primary is the orange fill and primary-ink the orange text, so never text-primary. inverse-surface is dark in both themes. shadcn's secondary is the system's secondary-container. ease-standard is cubic-bezier(0.4, 0, 0.2, 1). The type styles carry Material 3 names with the family's values (canonical §0.4, §3.4).
Family CSS name Tailwind CSS v4 Count
Color --color-<name> bg-<name>, text-<name>, border-<name>, fill-<name>, and outline-<name> 127
Font family --font-<key> font-sans and font-mono; font-email also compiles, for HTML email only 3
Font weight --font-weight-<name> font-normal, font-medium, font-semibold, and font-bold 4
Type style --text-<style>, with its --line-height, --letter-spacing, and --font-weight companions text-<style>, which sets all four 28
Spacing --space-<name>; the semantic ones also --spacing-<name> numeric p-4 from --spacing; semantic p-gutter 39
Radius --radius-<name> rounded-<name> 16
Shadow --shadow-<name> shadow-<name> 3
Size --size-<name> the numeric utility the token's note names, such as h-14 for --size-button-lg, or var(--size-<name>) inside an arbitrary value 50
Opacity --opacity-<name> CSS only 7
Layer --z-<name> the numeric utility the token's note names, such as z-30 9
Breakpoint --breakpoint-<name> sm: to 2xl: 5
Container --container-<name> max-w-<name> 10
Duration --duration-<name>; the five transition durations also --transition-duration-<name> duration-<name>, for those five only 18
Easing --ease-<name> ease-<name> 5
Animation --animate-<name>, with its @keyframes animate-<name> 10

The build also emits one type-override block (:lang(ar)), one product accent (tamakkan), one custom variant (short:, for a viewport 30rem tall or less), and the shadcn/ui map of 32 variables (FORMAT.md, "Added in 1.0.0").