color theory

Role-Based Tokens

Role-based tokens replace arbitrary hex values with named purposes that carry contrast guarantees inside the design system from the moment they are defined. A designer no longer chooses a shade of blue from a 12 step scale and hopes it works. They choose the token that the system has already validated for body text on subtle backgrounds or button borders or focus rings. This approach solves the core conflict between accessibility and design personality that the accessible color contrast article lays out so clearly. Teams get to keep their brand vivid because the tokens prevent bad pairings before a single pixel ships instead of forcing desaturated colors at the end of the project. The definitions live in one place whether that is a JSON file for your engineers, variables in Figma for your designers, or CSS custom properties for the shipped product. Change the value for a role and every instance updates while the contrast promise stays intact across light mode, dark mode, brand refreshes, and even perceptual updates. Modern systems combine this with perceptual models like OKLCH or APCA scores so the roles remain stable and readable across hues and viewing conditions without constant rechecking.

Role-based tokens are not marketing speak for the same old palette with friendlier labels. They are not the loose semantic tokens that only handle theme switching without any contrast rules attached to the relationships. They are not a replacement for good taste or brand strategy either. If your tokens let a designer pick brand-red for text on a pink background then they are not truly role-based. Real role-based systems restrict the options or warn on violation at the component level through linting or design token enforcement. They remove decision fatigue instead of adding new names to memorize. The old way treated every color as equal and left the math to the designer at pick time. The new way treats contrast as a first class property of the token so the math is done once by the system authors during setup and then forgotten.

Concrete examples prove how far this has come and exactly how to steal the best parts for your own system. Radix Colors built their entire primitive set around this idea back in 2021. Each color scale contains background roles from steps 1 to 4, interactive states in the middle steps, and high contrast text roles at steps 11 and 12. The aliasing documentation makes it dead simple. A designer reaches for text-contrast or solid and the WCAG AA requirement is already satisfied against the chosen surface no matter which scale they pull from. Companies like Vercel and Linear adopted this fully in their 2023 dashboard redesigns. Contrast failures dropped to zero because the decision was removed from the daily designer workflow. Material Design 3 took the concept mainstream with its on- roles when it launched in 2022. Anything placed on the primary container uses on-primary-container which is guaranteed by Google to meet 4.5 to 1 and often higher. The system even accounts for different container types versus plain surfaces so the pairings stay smart. Designers working in Figma simply pull from the variable collection knowing accessibility is built in at the foundation. GitHub Primer publishes the ratios openly next to every token on their primer.style site. Their fg-on-accent token lists its contrast against every possible background so engineers and designers can trust the system at a glance without opening WebAIM or Stark. Adobe Spectrum adds the perceptual layer that fixes the problems with old WCAG math that the article calls out. Their scales use custom perceptual models that keep contrast consistent when you change the brand color from purple to teal. A design team at a large financial institution switched their entire theme during a 2024 rebrand and every contrast score stayed green because the roles were built on perceptual uniformity not specific arbitrary hues. These are not cherry picked successes. Every system mentioned ships to millions of users daily without contrast related accessibility tickets landing in their support queues or audit reports.

This pattern extends beyond these four systems. Teams at Shopify with Polaris use surface-token and text-token pairings that update between light dark and even color blind modes while maintaining the ratios automatically. IBM Carbon publishes contrast minimums per role in their documentation and enforces them in their React components with built in checks. The common thread across all these examples is that contrast becomes a feature of the token not an afterthought applied in review or worse after the product has launched to users. The article takeaway is right. Accessibility lives at the token layer or it does not live at all. Role-based tokens are how you make that true in practice.

Deploy role-based tokens when your product has a future beyond the next quarter and when scale matters to your organization. They excel in design systems that serve multiple products or large distributed teams of designers and developers who all need to stay consistent. Use them for apps that must meet WCAG AA or face legal risk under laws like the European Accessibility Act, Section 508 in the US, or AODA in Ontario. They save weeks during audits and launch cycles by moving the work to the token definition step where it belongs. The four station testing workflow becomes trivial when the first station at token definition already locks the allowed surfaces. Avoid them for one-off designs, personal projects, or visual experiments where you want to break rules on purpose for artistic effect. Do not introduce them without training and documentation because a poorly documented role system creates new problems worse than the old hex free for all. Roll them out only when you can update components documentation and team habits at the same time or the effort will be wasted and the tokens will fall into disuse.

Role-based tokens let your brand stay loud while your interface stays readable because the hard choices happen once at the token definition layer instead of every time a designer clicks the color picker.

Related terms

Keep exploring