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.

Variables and dark mode: the finished result in FigCraft
Start the interactive lesson: narrated demo, steps and quiz →

What you’ll learn

Step by step

  1. Click Variables on the left rail.
  2. Click Create collection and name it Theme.
  3. Click + Create variable › Color. Name it surface/card, value FFFFFF.
  4. Click + next to the mode column to add a mode. Rename the columns Light and Dark.
  5. Give surface/card the Dark value 1E2624.
  6. Add surface/page: F2F4F3 / 121816.
  7. Add text/primary: 111111 / F2F4F3, and text/muted: 5C6B66 / 9FADA8.
  8. 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.
  9. Select the Profile frame. Under Variable modes, set Theme to Dark.
  10. Everything flips. Anything that didn't still uses a raw hex: bind it. Export… › CSS custom properties to see the code.

Tips

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.

← Variants: one component, many statesVectors, booleans and the Pen →

FigCraft is an open-source project by its own authors. Craftpath is an independent, free learning resource.