Sub topic 11
Encoding brand rules in templates and design tokens
This chapter assumes you can work in a design tool such as Figma, Illustrator, or InDesign. It also assumes you can read basic CSS and JSON. You have already seen how to read the color, type, and logo rules in a guideline document. Here you will turn those rules into files that people and tools reuse.
Why encode the rules
A PDF guideline depends on people reading it and remembering it. Someone copies a hex code from an old slide, someone else eyeballs the clear space, and the brand drifts. Encoding a rule puts the approved value where the work happens. The designer picks "primary" from a list instead of typing a code.
Two tools do most of this work:
- A design token is a named value, such as a color, font, or spacing unit, stored in one place and referenced by name everywhere else.
- A template is a pre-built file with the layout, styles, and locked elements already set to the guidelines.
From guideline to token
Start with the guideline's own words. A rule like "Accent is for highlights only" becomes a token plus a usage note. The note matters, because a bare hex value does not tell a teammate when to use it.
{
"color": {
"primary": { "value": "#0b3d91", "description": "Main brand blue. Use for headings and primary buttons." },
"accent": { "value": "#f2a900", "description": "Highlights only. Do not use for body text." }
},
"logo": {
"minWidthPx": { "value": 96, "description": "Smallest digital logo width." },
"clearSpace": { "value": "1x logo mark height", "description": "Minimum empty space on all sides." }
}
}The values here belong to an invented example brand. Logo rules can be tokens too, as the second group shows. Tools can read the numbers, and people can read the descriptions.
From tokens to code
On the web, tokens usually become CSS custom properties. Pages then refer to the variable name and never to a copied hex code.
:root {
--brand-color-primary: #0b3d91;
--brand-color-accent: #f2a900;
--brand-color-text: #1a1a1a;
--brand-color-background: #ffffff;
--brand-font-heading: "Example Sans", Arial, sans-serif;
--brand-font-body: "Example Serif", Georgia, serif;
--brand-space-unit: 8px;
}
h1 {
font-family: var(--brand-font-heading);
color: var(--brand-color-primary);
}
body {
font-family: var(--brand-font-body);
color: var(--brand-color-text);
background: var(--brand-color-background);
}If the brand blue changes, you edit one line and every page follows. In Figma, the equivalent is shared styles or variables in a team library.
Building templates that hold the rules
A good template makes the correct choice the easy one. Common practices:
- Set text styles for each level of the hierarchy, using the brand fonts and sizes.
- Link every fill and stroke to a color style, never a loose hex value.
- Place the logo as a locked component, with clear space shown by a guide or padding frame.
- Build layouts on the brand grid and use spacing multiples of the base unit.
- Add placeholder text and image frames, so users replace content without restyling it.
Naming and maintenance
Name tokens by role, not by appearance. --brand-color-primary survives a rebrand. --brand-color-blue becomes wrong when the blue turns green. Give the tokens a prefix, as above, so they do not collide with other libraries.
Keep one source of truth. If the CSS file and the design library each hold their own copy of the values, they will diverge. Version the token file and record what changed, so reviewers can see why a template updated.
Common errors
- Hard-coding a hex value "just this once" in a template.
- Tokens named by color rather than by role.
- Templates left unlocked, so the logo gets stretched.
- Copies of the token file in several places.
Exercise
A teammate's banner uses #0b3d91 typed directly into the fill field, and the brand blue was just updated. Why is this a problem, and what should the teammate do?
Show answer
A typed hex value is a copy that does not update when the brand blue changes, so the banner will keep the old color. The teammate should link the fill to the primary color token or style, so the change reaches the banner automatically.
Exercise
Why is "--brand-color-primary" a better token name than "--brand-color-blue"?
Show answer
It describes the role, not the appearance. If the brand's primary color changes to green, the name still makes sense, and no file needs renaming.