DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Foundations
ColorColors are the largest group of the library's tokens, and they make up most of
a theme. Each color token is named for its role. No token is named for how it
looks, because a name like --brand-blue-500 becomes wrong as soon as you change
the theme.Color rolesGroundsGrounds are the colors that content sits on. background is the page itself.
The surfaces above it form an ordered ladder:TokenSampleFor--helix-color-backgroundThe page background. Every other surface sits on it.--helix-color-surfaceA surface on the page, such as a card or a panel. The separation policy sets it apart with a fill, a border, or a shadow.--helix-color-surface-raisedA panel raised inside a surface, such as a card inside a card. Its fill is one step down the ramp.--helix-color-surface-overlayA surface over the page, such as a menu, a popover, or a dialog. Its edge and its shadow set it apart.--helix-color-surface-sunkenA recessed surface, such as a track or a groove. Its fill sets it apart. A field reads well.Choose a surface by where the element sits relative to the page. This is the
choice people most often get wrong. See Surfaces and
separation.A field is filled with well: 5% of foreground laid over whatever the field
sits on, so its color depends on the surface under the field. surface-filled
is a wash of foreground too, for a surface with separation="filled", such as
a filled Card or the ground of a spatial chart: 5% in light and 8.5% in dark.
Inside a Dialog, a Drawer, a Popover, an elevated Card, or a sunken region, the
dark wash is 6%, so a filled Card there stays under an elevated one. A row under the
pointer or the keyboard, such as an option, is lit with hover the same way:
8% of foreground in light and 12% in dark.A Button washes with its own tone and leaves hover alone. Each emphasis takes
its own steps:EmphasisAt restUnder the pointerUnder a pressghostNone8% in light, 12% in dark16% in light, 20% in darkoutlinedNone12%16% in light, 20% in darksubtle14%22%30%An Icon Button takes the same washes.Four more washes are laid over a ground the same way:
press lights a control under a press, a step past hover: 16% of
foreground in light and 19% in dark. A Button's own press is 20% in dark,
as the table above gives.
selected marks a chosen thing that stays chosen and has no fill of its own,
such as a range of days or a pressed toggle in a find bar. It is 13% of
foreground in light and 16% in dark.
primary-wash is the bubble of your own message in Chat. It is 20% of
primary with a brand color, and 16% of foreground with none.
track is the unfilled length of a bar, such as a Progress or Meter track.
It is 8% of foreground in light and 7% in dark, which on the page is the
surface-sunken rung, and it steps the same distance off a card or a panel.
Three more grounds sit outside the ladder:
surface-inverse is the mode's opposite, for a surface that has to read as
separate from the page, such as a tooltip. foreground-inverse is the text on
it.
surface-media and foreground-media are black and white in both modes. They
are the well behind a video and the controls drawn over it.
overlay is the scrim behind a modal Dialog, a Drawer, or a Lightbox: a
near-black at 40% in light mode, and black at 64% in dark.
InksInks are the colors that go on grounds. The base ink is foreground.
foreground-muted is for text that recedes and is still read, such as a
placeholder, a hint, or a caption. The engine solves it to the contrast
target.
foreground-subtle recedes further. It is for marks that are not text, such
as a separator, a chevron, or a grip. It is a fixed step of the gray ramp,
and the engine does not solve it, so its contrast is not guaranteed. Use
foreground-muted for text that is read. A disabled control fades whole,
through --helix-opacity-disabled.
Three opacities fade ink by a fixed amount:
--helix-opacity-disabled is 0.5, for a disabled control.
--helix-opacity-busy is 0.5, for rows that stay on screen while a new set
loads.
--helix-opacity-quiet is 0.72, for quiet text on a ground the text does
not know, where foreground-muted would be the page's gray. A chart
tooltip's names on the inverse bubble and a message still sending take it.
Text on a filled color takes the ink named for that fill:
foreground-on-primary on primary-surface
foreground-on-accent on accent-surface
foreground-on-status on the four status -surface fills
background on warning-solid
Lines and focus
border is the hairline edge of a card, a field, a divider, or a segmented
control's groove.
border-floating is the edge of a surface that floats over content, such as a
menu or a popover. It is border in light mode and 10% of white in dark mode,
so the edge still shows where a shadow cannot.
border-readonly is the edge of a read-only mark that carries a value, such
as a read-only Checkbox's box, a Radio's circle, a Switch's track, a Slider's
thumb, or a Rating's empty stars. It is 44% of foreground in light and 36%
in dark, from 3.1:1 to 3.4:1 on every ground, so the value still reads where
the field edge is 1.23:1.
border-hover is the edge of a field under the pointer. It is the brand color
when one is set, and a gray at about 3:1 on the white page when none is.
focus-ring is the color of the focus ring. It is primary, held at a
lightness of 0.6 or less in light mode and 0.65 or more in dark mode, so the
ring stays visible on the page.
IntentIntent colors show what something means.
primary and accent are for emphasis. Each has -hover, -active, and
-subtle variants. With no brand color set, both are ink: near-black in
light mode and near-white in dark mode. primary-surface and
accent-surface are their fills, each with a -surface-hover variant for
the fill under the pointer and a -surface-active variant for the fill under
a press.
info, success, warning, and danger are for status. Each has a
-surface variant, a filled ground that carries foreground-on-status, with
the same -surface-hover and -surface-active variants. A solid info,
success, or danger Button, Tag, Badge, or Icon Button fills its -surface
variant. A solid warning one fills warning-solid.
primary-strong is the far end of a ramp drawn in the brand color, such as
the busiest cell of a heatmap. It is primary-active held at a lightness of
0.33 or more, so the top of the ramp never reads as black.
neutral-subtle is a quiet gray for a mark that stands on the page, such as
an Avatar with no picture or a neutral Badge. It is 11% of foreground over
the page, mixed in sRGB, and opaque, so one avatar can overlap the next.
neutral-surface-hover and neutral-surface-active are a neutral fill under
the pointer and under a press. The neutral fill is foreground, which has
nothing past it, so both move toward the page, and the press moves further.
Each of the six tones has a -muted variant, such as danger-muted: the
tone's quiet ink, for text with that tone and emphasis="muted". It is the
tone's color at half the chroma. With no brand color set, primary-muted and
accent-muted are foreground-muted.
warning-mark is the warning color for a mark, such as a star, a Meter's
fill, or a Callout's icon. warning is solved for text and reads brown as a
shape, so in light mode a mark takes a lighter, more saturated step that
measures at least 3:1 on the page. In dark mode it is warning.
warning-solid is the warning fill under a label: a solid warning Button,
Tag, Badge, or Icon Button, and a warning Map Marker or Map Points. Its label
is background. In light mode it is a deep amber, #985f00, under white at
5.29:1. In dark mode it is warning-mark, #ffaf00, under black at 11.38:1.
brand-mark is the brand color for a graphic. The engine solves primary to
the theme's contrast target for text, and solves brand-mark to the 3:1 a
graphic needs, so brand-mark stays closer to the color you chose. With no
brand color set, it matches primary.
Rise and fallrise and fall color a value by which way it moved, such as a price. They
are success and danger unless you set them. Mainland China, Taiwan, and
Japan draw a rise in red, so a page for one of those markets swaps the two. See
Rise and fall colors.Mapscontour colors the contour lines of a map, a brown taken 45% of the way toward
foreground, so the lines read on a light map and on a dark one.SeriesHelix has twenty-four series colors for charts. They are ordered, so a chart
with three lines uses the first three. We chose the colors so that the first
ones in the list stay easy to tell apart, however many a chart uses.SyntaxThe eight syntax roles for code are callable, comment, constant,
invalid, keyword, name, string, and tag. A full editor theme has more
roles. Helix has fewer because code in documentation only needs to be read.ScrollbarsScroll Area, Chat, and Virtual List color their scrollbars with three
tokens:
--helix-scrollbar-thumb-color is the thumb at rest. It is a mid gray that
measures at least 3:1 against the page and every surface, in both modes. It
also clears 3:1 on the rungs inside a Dialog, a Drawer, or a Popover.
--helix-scrollbar-thumb-hover-color is the thumb while the pointer is over
its scroller. It is foreground-muted, a step closer to the text than the
thumb at rest: darker in light mode and lighter in dark mode.
--helix-scrollbar-track-color is the track behind the thumb. It is
transparent, so the scroller's own ground shows through.
Each of the three reads its own hook first, such as --scroll-area-thumb-color
or --chat-scrollbar-thumb-color, so you can recolor one scroller and leave
the rest. Set the tokens to recolor all three. Other families that scroll keep
the browser's own scrollbar.Why colors use OKLCHEvery Helix color is written in OKLCH. In sRGB, equal numeric steps do not look
equal, which makes ramps and contrast math unreliable. A ramp with even numeric
steps looks uneven. A contrast solver that works in sRGB cannot converge on a
target that it can measure.OKLCH lets the theme engine solve for a palette from your brand color. See
Deriving a theme.How the engine meets contrast targetsThe engine measures each ink against the ground it will be painted on. A brand
color that already meets the target there is used as it is. For any other color,
the engine searches for the lightness that meets the target. A pair that cannot
meet its target, such as one with a color you pinned, is reported in
violations.foreground and foreground-muted are also written in fields, so the engine
solves them against the well over the page, a card, a raised surface, a dialog,
and a sunken surface. The report names each of these grounds as the well over
its surface, such as color-well over color-surface.Both inks are also written on a row under the pointer, a chosen row, a pressed
row, and a row tinted as selected. The engine solves them against these grounds
as well:
hover, selected, and press over each of the same five surfaces, such as
color-hover over color-surface and color-press over color-surface
primary-subtle and accent-subtle, the tints a selected row takes
the well over each tint, for a field on a selected row
foreground-subtle is the one ink the engine does not solve. The range of
readable grays has room for one quiet ink, and foreground-muted is that ink, so
foreground-subtle stays a fixed step of the stylesheet's gray ramp and its
contrast is not guaranteed. A component paints its quiet text in
foreground-muted, and keeps foreground-subtle for marks that are not text and
for a mark that recedes.The engine can solve only the pairs it knows about, so we check two things:
We compare the engine's surface model with what the components paint.
We measure every pair on a rendered page.
The second check finds pairs that no single CSS rule states. Only eleven rules
in the library set an ink and a ground together. Another 165 set only an ink,
and 112 set only a ground. The cascade combines them into the rest of the
pairs, and each of those pairs must still be readable.Use only semantic tokens/* Yours to read. */color:var(--helix-color-foreground-muted);/* Not yours to read, and the `tokens` rule fails the build on it. */color:var(--_helix-neutral-500);Primitive tokens such as --_helix-neutral-500 belong to helix/styles. The
underscore marks them as private. Components use only semantic tokens, such as
--helix-color-primary. A theme can change what a semantic token resolves to,
and no component depends on which step of which ramp a color comes from.