Home/Help/State machine/Tokens and themes

STATE MACHINE

Tokens and themes

A token is a named value that properties link to: change it once and every linked property follows. A theme gives tokens other values, such as a Dark version or another brand's color. Default is the file's own values; every other theme falls back to Default wherever it has no value of its own. A flow can switch themes, and so can the page that plays the file.

Do it in the editor: guided tour7 steps · about 4 minutes · opens a practice scene

Step by step

  1. Select the pill

    Click the switch's pill on the canvas. The inspector shows its properties.

  2. Make its color a token

    Point at Fill in the inspector: a token mark shows after its name. Click it and pick New token from this value…. The token is named after the layer and property (Pill · Fill), and the linked row turns violet. Another layer's fill can link to the same token from its own mark.

  3. Open Tokens & themes

    Click the violet mark again and pick Tokens & themes…. The window lists the tokens down the side and the themes across the top; ☰ › Edit has it too.

  4. Add a theme

    Click + after the last theme, type Dark and press Enter. Its values are Default's, in grey, until it has its own.

  5. Show it on the canvas

    Click Dark's name: the canvas shows the Dark theme. A value typed in Dark's column is Dark's own; × gives it Default's back.

  6. Give Dark its own color

    Close the window and type #3b3f73 in the pill's Fill. While Dark shows, a change to a linked property belongs to Dark; Default keeps its color.

  7. Switch back

    Click Theme: Dark in the canvas bar and pick Default. The pill takes Default's color again; the picker switches between them whenever you like.

Good to know. Auto token (the switch in the canvas bar while a theme other than Default shows): a change to a property with no token gives it one, so the change belongs to that theme. A flow's Switch theme action changes the theme as it plays. In an exported file the page switches with player.theme("Dark"); a token marked Set by the page takes its value from the page: player.token("Brand color", "#c9366e"). A text block and a picture can be tokens too.

Keys

EscClose the window