Studiov1.1.0

Token Reference

Complete reference for all 54 global design tokens, locked governance tokens, and the inheritance resolution model

Token Reference

Brand Studio manages 54 global design tokens across three types: colors (27), typography (14), and spacing (13). Every brand inherits these tokens, optionally overriding individual values.

Color Tokens

Brand Colors

Token NameHexDescription
brand_amber#C55A11RDC logo D block. Brand spec v1.0.
brand_green#548235RDC logo R block. Brand spec v1.0.
brand_navy#002060RDC logo C block. Brand spec v1.0.
bright_green#70AD47Bright accent green
coral_red#C5192DCoral red accent
dark_teal#063035Dark teal background
deep_gold#BA8C00Deep gold accent
gold#DDA63AGold accent
medium_teal#095A63Medium teal
prt_green#3F7E44PRT brand green
sdg_blue#0A97D9SDG reference blue

Five Capitals Colors

Token NameHexCapital
cap_built#4472C4Built / Manufactured Capital
cap_financial#C5192DFinancial Capital
cap_human#DDA63AHuman Capital
cap_natural#548235Natural Capital
cap_social#7030A0Social Capital

Text Colors

Token NameHexUsage
text_primary#262626Primary body text
text_secondary#767171Secondary / muted text
text_white#FFFFFFText on dark backgrounds

UI Surface Colors

Token NameHexUsage
border_default#CCCCCCDefault border color
surface_alt_row#E1E5EBAlternating table row background
surface_light#F1F5F5Light surface background
surface_warm#FFF8E5Warm-toned surface
surface_white#FFFFFFWhite surface

Unit Colors

Token NameHexLane
unit_a#548235Lane A -- Real Assets and Land
unit_b#C55A11Lane B -- Stewardship and Credits
unit_c#002060Lane C -- Enablers and Technology

Typography Tokens

Each typography token stores a JSONB value with font_family, font_size_pt, font_weight, and context.

Token NameFont FamilySize (pt)WeightContext
bodyCalibri11Regulardocument
body_boldCalibri11Bolddocument
captionCalibri9Regulardocument
displayF37 Jan36Boldpresentation
equationCambria Math11Regulardocument
heading_1Calibri Light20Bolddocument
heading_2Calibri Light16Bolddocument
heading_3Calibri13Bolddocument
heading_4Calibri11.5Bolddocument
slide_bodyF37 Jan16Lightpresentation
slide_captionF37 Jan11Lightpresentation
slide_headingF37 Jan24Regularpresentation
table_bodyCalibri10Regulardocument
table_headerCalibri10Bolddocument
titleCalibri Light28Bolddocument

Spacing Tokens

Each spacing token stores a JSONB value with value_px and context.

Scale Spacing

Token NameValue (px)Description
spacing-14Base unit
spacing-28Tight
spacing-312Compact
spacing-416Default
spacing-520Medium
spacing-624Comfortable
spacing-832Spacious
spacing-1040Section
spacing-1248Large
spacing-1664Extra-large
spacing-2080Page
spacing-2496Hero

Document Spacing

Token NameValue (px)Description
body_space_after6Space after body paragraphs
bullet_indent18Bullet list indentation
h1_space_after12Space after H1
h1_space_before24Space before H1
h2_space_after8Space after H2
h2_space_before18Space before H2
page_margin_bottom72Page bottom margin
page_margin_left72Page left margin
page_margin_right72Page right margin
page_margin_top72Page top margin
table_cell_pad_lr8Table cell horizontal padding
table_cell_pad_tb4Table cell vertical padding

Locked Tokens

Eleven tokens are governance primitives. A database trigger rejects any attempt to modify their hex_value, category, or token_name. These tokens can be read and used freely but cannot be changed without an explicit unlock-then-relock governance action.

Token NameLocked HexReason
brand_amber#C55A11RDC logo R=green, D=amber, C=navy. Brand spec v1.0.
brand_green#548235RDC logo R block. Brand spec v1.0.
brand_navy#002060RDC logo C block. Brand spec v1.0.
cap_built#378ADDFive Capitals regenerative standard. Note: the global_design_tokens table has #4472C4 but the locked value in brand_colors is #378ADD -- the brand_colors lock is canonical.
cap_financial#C8A84BFive Capitals regenerative standard.
cap_human#00E5FFFive Capitals regenerative standard.
cap_natural#1D9E75Five Capitals regenerative standard.
cap_social#7F77DDFive Capitals regenerative standard.
unit_a#548235Lane A, Real Assets and Land. PRT PPM/DST -- legal requirement.
unit_b#C55A11Lane B, Stewardship and Credits. PRT PPM/DST -- legal requirement.
unit_c#002060Lane C, Enablers and Technology. PRT PPM/DST -- legal requirement.

The database trigger error message when a locked token is modified:

brand_colors: token "cap_natural" is locked and cannot be modified. Unlock it first if a change is intentional.

To unlock, modify, and relock a token (governance decision required):

UPDATE brand_colors SET is_locked = false WHERE token_name = 'cap_natural';
UPDATE brand_colors SET hex_value = '#newvalue', is_locked = true WHERE token_name = 'cap_natural';

Token Inheritance Model

The token system uses a two-layer inheritance model stored in Supabase:

global_design_tokens          (54 base tokens)
         +
brand_token_overrides         (per-brand delta -- only overridden values)
         =
TokenWithInheritance[]        (resolved set with inheritance context)

A brand with zero overrides inherits 100% of the global base. A brand can override any subset of the 54 tokens. Only the overridden values are stored in brand_token_overrides.

Resolution Algorithm

The resolveTokens() function in token-resolver.ts merges both layers:

import { resolveTokens, getTokenDiff, injectResolvedTokens } from "@/lib/token-resolver";
 
// 1. Fetch both layers from Supabase
const [{ data: globals }, { data: overrides }] = await Promise.all([
  supabase.from("global_design_tokens").select("*"),
  supabase.from("brand_token_overrides").select("*").eq("entity_id", brandId),
]);
 
// 2. Resolve: every global token appears, with override applied if present
const resolved = resolveTokens(globals ?? [], overrides ?? []);
 
// 3. Split into overridden vs inherited (for diff view)
const { overridden, inherited } = getTokenDiff(resolved);
 
// 4. Inject as CSS custom properties (client-side only)
injectResolvedTokens(resolved);

TokenWithInheritance Type

Each resolved token carries full inheritance context:

interface TokenWithInheritance {
  token_name: string;                    // e.g. "brand_green"
  token_type: "color" | "typography" | "spacing";
  category: string | null;              // e.g. "brand", "five_capitals", "scale"
  globalValue: TokenValue;              // always from global_design_tokens
  overrideValue: TokenValue | null;     // from brand_token_overrides, null if inheriting
  resolvedValue: TokenValue;            // overrideValue ?? globalValue
  isOverridden: boolean;                // true if an override row exists
  overrideId: string | null;            // override row UUID (for update/delete)
}

Resolver Functions

FunctionSignaturePurpose
resolveTokens(globals, overrides) -> TokenWithInheritance[]Merge global tokens with brand overrides
getTokenDiff(resolved) -> { overridden[], inherited[] }Split resolved tokens into overridden vs inherited
resolveColorsWithInheritance(resolved) -> TokenWithInheritance[]Filter to color tokens only
injectResolvedTokens(resolved) -> voidSet CSS custom properties on document.documentElement

CSS Variable Naming

Token names map to CSS custom properties using the cssVarName() helper from @regen/design-tokens. The function prepends -- to the token name, preserving underscores:

import { cssVarName } from "@regen/design-tokens";
 
cssVarName("brand_green");   // "--brand_green"
cssVarName("cap_natural");   // "--cap_natural"
cssVarName("spacing-4");     // "--spacing-4"

Usage in CSS and JSX:

/* Correct -- underscores preserved */
color: var(--brand_green);
background: var(--surface_light);
padding: var(--spacing-4);
 
/* Wrong -- do not convert underscores to dashes */
color: var(--brand-green);

CSS Variable Injection by Type

When injectResolvedTokens() runs, it sets different properties depending on token type:

Token TypeCSS Properties Set
Color--token_name (hex value)
Typography--token_name-family, --token_name-size, --token_name-weight
Spacing--token_name (px value)

Example injected properties for the heading_1 typography token:

--heading_1-family: "Calibri Light";
--heading_1-size: 20pt;
--heading_1-weight: 700;

JSONB Value Shapes

Token values are stored as JSONB in both global_design_tokens and brand_token_overrides. Each token type has a distinct shape:

// Color (token_type: "color")
{ hex: "#548235", rgb_r: 84, rgb_g: 130, rgb_b: 53 }
 
// Typography (token_type: "typography")
{ font_family: "Calibri Light", font_size_pt: 20, font_weight: 700, context: "document" }
 
// Spacing (token_type: "spacing")
{ value_px: 16, context: "default" }