Color → Tokens
Color tokens
Tokens are a method of applying color in a consistent and meaningful way across the admin. They provide a layer of abstraction from the hex values themselves, making it easy to implement large scale changes across the admin.
See the token section for the full list of color tokens and their descriptions.
Semantic tokens
Semantic tokens help communicate the intent of a given color and create predictable behavior across our tokens. They start with declaring the token group color, followed by the element it's applied to, such as a bg, border, text, or icon.
Following the element, semantic tokens may have one or more modifiers to further represent color application: color role, prominence, and state.
Element: The UI element being styled: bg, bg-surface, bg-fill, text, border, and icon.
Role: Assigns roles to specific colors for consistent application.
Prominence: Communicates what the token is used for.
State: Communicates the state of a UI element.
Specialty tokens
Some concepts have their own specific color tokens, known as specialty tokens. Specialty tokens start with declaring the concept and any associated variants, followed by the semantic token structure. These tokens should never be used for anything other than the concept they’re referencing.
Interaction states
Interaction states are communicated by adding -hover, -active, -selected, or -disabled to the end of the semantic token. For example, the state token for -color-bg-surface is -color-bg-surface-hover.
Hover
Hover state tokens provide visual feedback to merchants when they hover their cursor over an interactive element, like a button or link.
Active
Active state tokens communicate when an interactive element is pressed (by a cursor or finger).
Focus
Focus states are triggered by the merchant and highlight elements when using a keyboard to navigate the UI.
Focus states usually take on the element’s hover state and add a blue outline using the border-focus token.
Selected
Selected state tokens communicate an item or option has been chosen. They can be applied to elements like buttons, tabs, checkboxes, radio buttons, or navigation items.
Disabled
Disabled state tokens indicate when the user isn’t allowed to interact with an element. They remove all interactivity from a component.
Disabled elements don’t need to meet WC3 contrast standards and are intentionally de-emphasized to clearly communicate their state.
How to apply them
Figma
Accessing Polaris color tokens is simple using Figma variables, found in the fill, stroke and text color library menus on the right panel.
Polaris react
Color tokens are applied to components and are available via css variables to style custom UI elements within the Shopify admin.