DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Theming
TokensHelix has two layers of tokens. You use the second layer, the semantic tokens.LayerShapeWho may use itPrimitive--_helix-neutral-500@fusion.dev/helix-styles onlySemantic--helix-color-primaryAny code, including yoursEach semantic token is named for its purpose. The name does not describe its
value. Every token belongs to exactly one of seventeen categories:
color
scrollbar
space
radii
font
text
weight
leading
tracking
border
shadow
material
opacity
duration
easing
size
layer
The leading underscore marks a token as private. We may rename or re-space any
--_helix- token without notice. Code that uses a primitive token can break
when you update Helix, so use the semantic tokens.Surface tokensA surface's depth is its distance from the page, in whichever direction has
room. The page is white in light mode and black in dark mode. In light mode
nothing is lighter than white, so a raised surface is darker than the page.
background: the page.
surface: a plane on the page, such as a card or a panel you own.
surface-raised: something lifted that still lies on the page, such as
a card inside a card, or the header of a Code Block or a Terminal. The page
surrounds it on all sides, so its fill sets it apart. On a white page, that
fill is one step darker.
surface-overlay: something over the page, such as a menu, a popover, a
dialog, or the thumb of a switch or a segmented control. Its edge, its
shadow, and the content it covers set it apart, so on a white page it is
white. In dark mode it is the same rung as surface-raised.
surface-sunken: a recessed fill, such as a progress track, a keyboard
key, or the groove of a segmented control.
Two fills are a step from whatever ground they sit on, so they read the same on
the page, a card, or a raised surface. --helix-color-well fills a field, such
as an input. --helix-color-hover lights a row under the pointer, such as an
option or a menu item.Use raised and overlay for different jobs. In dark mode they are the
same color, #181818, so either token can seem to do both jobs. In
light mode they need opposite fills. A Code Block's header must be darker than
a white page, and a thumb must be lighter than the groove it sits in. A menu is
white on a white page, set apart by its edge and its shadow. If a surface looks
almost right in dark mode and wrong in light mode, it usually uses the wrong one
of these two tokens.Per-component hookshelix-card{--card-padding:var(--helix-space-lg);}--card-padding is a hook that the card component exposes. Hooks are separate
from the Helix tokens. Each component documents its own hooks, and each hook
defaults to a semantic token. Use a hook to adjust one component. Use the
semantic tokens to change every component.What fails the buildThe build fails on four kinds of error:
A raw value where a token exists, such as #e5e5e5 where a neutral token
fits.
A primitive token used outside @fusion.dev/helix-styles.
A reference to a token that does not exist.
A component hook that nothing reads, or a primitive token that nothing
resolves to.
The third check would be worth running on its own. When a token is renamed, a
reference to the old name resolves to nothing. The property falls back to a
browser default without a warning. The code looks correct, and the component
loses its styles.Color modesEach token declares its light and dark values in one declaration:--helix-color-surface:light-dark(var(--_helix-neutral-50),var(--_helix-neutral-925));The color-scheme property alone decides which value applies. You set the
color mode with one attribute, and no token is declared twice. Set
data-color-mode="light" or "dark" on any element to set the mode for that
element and everything inside it. color-scheme inherits, so one attribute
shows a light preview inside a dark page.Without the attribute, the mode follows the operating system.