Skip to Content
sdeck docs

Looks

Design a button from layers, states and live values.

A look is a background and layers: text, images, progress bars and rectangles. The composer draws it large: click a layer to pick it, drag it or its handles to place it (it snaps to edges and centers; Alt turns that off), and use the arrow keys to nudge it. The list shows the front layer first; drag to reorder, duplicate or delete. The button beside Composer opens it large.

A layer is laid out automatically (top, middle or bottom, and side by side with others in the same row) or placed freely, by a frame in percent of the slot, over whatever is under it:

const look = {
  background: "#111827",
  layers: [
    iconLayer("bell", "lucide/bell", { size: 70 }),
    // A count on top of the icon.
    textLayer("count", "{{vars.unread}}", { frame: { x: 55, y: 5, width: 40, height: 35 } }),
  ],
};

An image layer shows the first frame of a GIF or animated WebP. Turn on its Animate to play it, at up to 10 frames a second (a GIF picked from a file plays at once). The composer itself stays still. Images stop moving while the deck is dimmed. Everything on a deck shares its speed, so one or two moving buttons on a page are fine; a page full of them can slow the others down.

Rectangles are for panels, pills, dots and outlines. Add one with the rectangle button, then set its color or gradient, how round its Corners are, and an Outline. It starts in front: drag it down the list to put it behind other layers. It is always placed freely. With very round corners, a wide one is a pill and a square one a circle. States can change its fill and the outline's color.

Bars show a value from 0 to 100 along the top or bottom. From the edges lifts one off the border of the key, and Corners rounds it.

The button's own values. Clock, Date, Timer, Stopwatch and Counter give their look the parts they are made of: {{self.hour}}, {{self.minute}}, {{self.second}}, {{self.weekday}}, {{self.month}}. Press Customize under Look to move, restyle or remove each of them, and the braces button in a text to see all there are. They follow the settings: the hour is 16 or 4, and the seconds are empty while they are off.

Timers and stopwatches everywhere. Each one is also a variable for any label, look, condition or workflow, whichever page it is on: {{basics.timers.tea.time}}, {{basics.stopwatches.run.time}}. The name comes from the button's label (Focus time is focus_time), or is what you enter as its Variable name. Without either it is where the button is, such as main_key_3. A second one of the same name gets _2. The braces button lists them all under Basics.

BothTimers
time as text: 4:59remaining and total, in seconds
counting, paused: yes or noprogress, 0 to 100
labeldone: yes or no
endsAt, while it counts: {{time("HH:mm", basics.timers.tea.endsAt)}}

Stopwatches have elapsed, in seconds. For another format: {{duration(basics.timers.tea.remaining, "mm:ss")}}. Timers go on and end on time while another page is shown. The trigger When a timer ends then says which one as event.name.

Taking turns. One slot can show several things one after another: a label for five seconds, then the time, then the CPU, and round again. Under Take turns in the composer, switch on the layers that take part, set how long each shows and their order. Put them in the same place and they swap there. Each one is shown while turn([5, 5, 3]) == <its place>, so the same works in any expression: turn follows the clock, so everything taking turns with the same times changes together.

States. A state changes the look while something is true: other text while music plays, red while the CPU is busy. Under States, add one, name it and say when it applies. Each condition compares a variable with a value, or is an expression, and a green dot marks what is true now. Then set only what is different: each layer shows its normal text, image, value and color until you give it another, the eye hides it, and the round arrow puts it back. While a state is open the preview shows that state; the tabs above the preview switch between it, the normal look and what applies live. If several states apply at once, lower ones win.

States can take turns too. Switch on Take turns in each, and Turns lists them with the normal look: their times and order are set there once. A state whose condition does not hold in its turn leaves the normal look showing.

Sensors show no text. Their slots draw icons, images and bars only: text layers are left out, as is any text a plugin's component draws there, and the composer does not offer to add it.

Text and expression boxes color what you type, complete variable names inside {{, format expressions, show what they say now, and have a button that lists every variable and function with its current value.