
Design Tokens in a Theme
I spent three hours yesterday digging through a client’s “custom” build, only to realize they hadn’t actually built anything—they had just layered sixty different hex codes over a broken page builder. It’s the same old story: people think they need a massive, enterprise-grade design system to stay organized, but they’re actually just drowning in technical debt. If you’re looking for a way to clean up the mess, learning how to define design tokens in a theme isn’t about buying a new plugin or following some bloated industry trend; it’s about reclaiming control over the decisions that are currently making your CSS a nightmare.
I’m not here to sell you on a complex workflow that requires a PhD in mathematics to maintain. Instead, I’m going to show you how to strip away the noise and implement a system that actually works for a real-world WordPress environment. We’re going to talk about setting up a scalable foundation that keeps your typography and colors consistent without the unnecessary bloat. By the end of this, you’ll know exactly how to bake these rules into your theme so you never have to hunt for a specific shade of “off-white” ever again.
Table of Contents
Reading the Intent Behind Primitive vs Semantic Tokens

Most people jump straight into naming things “blue” or “large-font,” and that’s exactly how you end up with a codebase that feels like a junk drawer. When I’m auditing a site, I look for the distinction between what a color is and what a color does. This is the core of semantic vs primitive tokens. Primitive tokens are your raw ingredients—the hex codes and pixel values that don’t care about context. They’re just values sitting there. If you hardcode `color-blue-500` into your buttons, you’re basically setting a trap for your future self.
The real magic happens when you start tokenizing design properties based on intent. Instead of telling your CSS to use “blue,” you tell it to use `action-primary-background`. This layer of abstraction is what separates a professional build from a hobbyist project. If a client decides six months from now that their brand is moving from blue to forest green, you shouldn’t have to hunt through a thousand lines of code to find every instance of that specific shade. You just update the semantic mapping, and the whole site follows suit. It’s about building a system that survives the inevitable “can we change this?” email.
Establishing Design Token Naming Conventions That Actually Work

Naming things is the part of the job that makes me want to close my laptop and go stare at a wall. It’s easy to get caught up in the “aesthetic” of a list, but if your design token naming conventions are a mess, your theme is going to be a nightmare to maintain six months from now. I’ve inherited enough “broken” sites to know that the moment you name a color `$brand-blue-light`, you’ve already lost the battle. What happens when the client decides they hate blue? You’re stuck hunting down every instance of that variable like a detective in a bad noir film.
Instead, you need to focus on the intent behind the value. If you’re tokenizing design properties, stop describing what they look like and start describing what they do. A button shouldn’t be “blue”; it should be `action-primary-background`. This is the core of a functional design system architecture: creating a layer of abstraction that allows you to change the skin of a site without rewriting the entire logic. If your naming convention is built on purpose rather than appearance, you aren’t just making a theme—you’re building something that can actually scale without collapsing under its own weight.
Stop Guessing and Start Governing: 5 Rules for Token Sanity
- Don’t name tokens after what they look like. Calling something `$blue-500` is a trap that will haunt you the second a client asks for a brand refresh. Name them for what they do—like `$action-primary-background`—so you aren’t renaming fifty variables when the hex code changes.
- Audit the bloat before you build the system. I’ve inherited so many sites where the “design system” was just a pile of random CSS variables dumped into a file by someone who didn’t know better. Map out your existing values first; you’ll realize half of them are just duplicates of the same three shades of gray.
- Limit your scale or you’ll never finish. You don’t need fourteen levels of spacing or a twenty-step color ramp. Pick a sensible mathematical scale—like a 4px or 8px increment—and stick to it. If you give yourself too many options, you’re just creating more decisions for your future self to regret.
- Treat your tokens like a contract. Once you define a token for a specific UI element, that’s the law. If you start hardcoding values or “just adding one quick hex code” to a stylesheet, you’ve broken the system, and you’re officially back to the dark ages of manual CSS maintenance.
- Document the “why,” not just the “what.” A token list without context is just a dictionary no one wants to read. If a certain spacing token exists to solve a specific layout quirk in the header, say so. It saves the next developer (probably you, six months from now) from breaking the layout while trying to be “helpful.”
Stop Guessing and Start Deciding

At the end of the day, defining design tokens isn’t about adding more layers of complexity to your CSS; it’s about reclaiming control over the decisions baked into your theme. We’ve covered why you can’t just dump a list of hex codes into a file and call it a system, and why your naming conventions need to actually make sense to a human being, not just a machine. By separating your primitives from your semantic tokens, you aren’t just organizing variables—you are building a logic layer that prevents the inevitable “CSS spaghetti” that happens when a client asks for a tiny tweak six months down the line. If you do this right, you won’t be fighting your theme; you’ll be directing it.
I’ve spent way too many hours un-building sites that were crippled by inconsistent styles and “quick fix” color overrides. Don’t let your next project become another entry in my folder of cautionary tales. Building a token system is an investment in your future sanity, ensuring that when you eventually hand a site over, it’s a cohesive piece of architecture rather than a house of cards. Stop treating your styles like an afterthought and start treating them like the foundation they are. Once you master the tokens, the design stops being a series of guesses and starts being a set of intentional decisions.