Level 2 · Reusable, systematic design · about 12 minutes · free
Variables and dark mode
Variables give values names, like surface/card. With modes, one name holds a light and a dark value, and a whole screen switches theme in one click.
Start the interactive lesson: narrated demo, steps and quiz →
What you’ll learn
- Create a collection and colour variables
- Add Light and Dark modes
- Bind fills and switch a frame's mode
Step by step
- Click Variables on the left rail.
- Click Create collection and name it Theme.
- Click + Create variable › Color. Name it
surface/card, value FFFFFF. - Click + next to the mode column to add a mode. Rename the columns Light and Dark.
- Give
surface/card the Dark value 1E2624. - Add
surface/page: F2F4F3 / 121816. - Add
text/primary: 111111 / F2F4F3, and text/muted: 5C6B66 / 9FADA8. - Bind fills: select the card's fill, click the four-dot icon and pick surface/card. Do the same for the page, name, subtitle and bio.
- Select the Profile frame. Under Variable modes, set Theme to Dark.
- Everything flips. Anything that didn't still uses a raw hex: bind it. Export… › CSS custom properties to see the code.
Tips
- Two layers of tokens. Palette (green/600) and roles (surface/card) that point to it. Rebrands change the palette only.
- Mode switching finds mistakes. Anything that doesn't flip to dark is still a raw hex. Switch modes often.
- Name by role, not by look. ‘text/muted’ survives a rebrand. ‘grey-light’ doesn't.
Check yourself
After switching to Dark, the name text stays black. Why?
Its fill is a raw hex, not bound to a variable. Bind it to text/primary.
FigCraft is an open-source project by its own authors. Craftpath is an independent, free learning resource.