Tokens
Tokens are Hodi's CSS variables, such as var(--text-2). A plugin uses them in its styles instead of a hard-coded value: a token colour changes with the theme (Dark, Light, Poudré), a hard-coded colour doesn't. The samples on this page follow the theme picked at the top of the site.
Using a token
A token is used with var(), in the web part's CSS file. Hodi defines every token on its page: the plugin has nothing to import.
.hello-world-answer {
color: var(--text-2);
border: 1px solid var(--border);
border-radius: var(--radius-card);
}The components of hodi:sdk already use these tokens. A plugin only needs them for its own classes.
Backgrounds
From deepest to highest: the page, then the columns, then the cards, then the controls on the cards.
--bgThe page's background.
--columnThe columns' background, and the page's on a phone.
--cardA card's background, and the active row of a list.
--card-hoverA hovered card's background in a list.
--controlThe background of buttons, fields and chips.
--control-hoverA hovered button or field's background.
--raisedThe background of an element placed above a card.
--tileThe icon square's background in empty states and errors.
Texts
--textThe main text: titles, labels, values.
--text-strongA text slightly softer than --text.
--text-2The secondary text: descriptions and help lines.
--text-3The discreet text: captions, icons at rest.
--text-faintThe faintest text: a disabled state.
Borders
--borderThe border of every control and every card.
--border-strongA stronger border, on hover for example.
--dividerThe line between two sections.
Accent
The accent is the brand's colour: the logo's dot, the active tab, the counters. It is rust in Dark and Light, pink in Poudré, or the accent colour a profile picked in its settings.
--rustThe accent colour itself.
--rust-textA text in the accent colour.
--rust-strongAn accent text, stronger than --rust-text.
--rust-surfaceA background tinted with the accent.
--rust-surface-2A background tinted with the accent, deeper.
--rust-borderA border in the accent colour.
--link-hoverA hovered link.
States
Red says something failed or is about to be deleted. Green says something is accepted. Yellow warns.
--dangerAn error: its text and its icon.
--destructiveA delete button's background (look="danger").
--destructive-borderA delete button's border.
--destructive-textA delete button's text.
--approveThe background of something accepted.
--approve-borderThe border of something accepted.
--approve-textThe text of something accepted.
--warningA warning.
AI
Purple marks a click that spends AI credits, such as the AiButton button.
--aiThe AI colour: an icon, a line.
--ai-surfaceAn AI area's background.
--ai-borderAn AI area's border.
--ai-textAn AI area's main text.
--ai-text-2An AI area's secondary text.
Information
Blue marks a note that explains how a screen works.
--info-surfaceAn information note's background.
--info-borderAn information note's border.
--info-iconAn information note's icon.
--info-textAn information note's text.
News topics
Each news topic has its colour: Belgium, World, Tech… An element with the data-topic attribute gets that topic's three tokens. The samples below show the tech topic.
<span className="hello-world-topic" data-topic="tech">
Tech
</span>--topicThe topic's colour.
--topic-borderA border in the topic's colour, softened.
--topic-surfaceA very dark background in the topic's colour.
Layers
--glassThe background of a button floating over an image.
--scrimThe veil behind an open window.
--shadowThe shadow of a floating element.
Fonts
--font-bodyRunning text (Geist).
--font-monoCaptions, metadata and code (Geist Mono).
--font-displayLarge titles, in capitals (Bebas Neue).
Corners
--radius-thumb10 px: a thumbnail, an image.
--radius-card16 px: a card.
--radius-panel20 px: a window, a large panel.
--radius-pillA pill: a button, a chip.
Motion
Every transition in Hodi is gentle: nothing jumps. A plugin's transition uses the same values.
.hello-world-card {
transition: background var(--duration) var(--ease);
}--duration160 ms: a transition's length.
--easeA transition's curve, cubic-bezier(0.2, 0, 0, 1).