Skip to content

Theme tokens

A theme is a list of tokens: names such as accent or text_muted with a color (or a size) each. Components never hard-code colors; they ask the theme for a token. That is why one change to the theme restyles everything.

You use tokens in two ways:

pz.text("Total").style(color="text_muted") # by name, anywhere a color goes
pz.container(body, bg=self.resolved_theme().surface) # as an attribute of the theme

Colors are #rrggbb or #rrggbbaa (the last two digits are the opacity). Token names work in style(), in a component’s color=/tint= parameters, in pz.Paint and in the designer’s color fields.

The large areas of the window, from the back to the front.

TokenWhat it colorsOne DarkOne Light
backgroundThe window behind everything, and app chrome such as the title and status bars of generated themes.#3b414d#dcdcdd
surfaceCards (ui.card), stats and other raised areas.#2f343e#ebebec
elevatedFloating things: menus, popovers, dropdowns, tooltips, dialogs, toasts and the command palette.#2f343e#ebebec
editorWhere people type: text fields, the code editor, the terminal background in generated themes.#282c33#fafafa
panelSide panels and docks of a workspace, the help panel.#2f343e#ebebec
title_barThe custom title bar (ui.title_bar, ui.window_frame).#3b414d#dcdcdd
status_barThe status bar at the bottom of a workspace.#3b414d#dcdcdd
tab_barThe strip behind the tabs of a tab bar.#2f343e#ebebec
tab_activeThe selected tab.#282c33#fafafa
tab_inactiveThe other tabs.#2f343e#ebebec
terminalThe terminal widget background.#282c33#fafafa
TokenWhat it colorsOne DarkOne Light
borderMain borders: inputs, outline buttons, dividers, frames.#464b57#c9c9ca
border_variantSofter borders: cards, filled buttons, list separators.#363c46#dfdfe0
border_focusedThe ring around the focused input or list.#47679e#7d82e8
border_selectedThe border of selected items (a translucent accent).#293b5b#cbcdf6

Elements are filled controls (the default ui.button, chips, segmented controls). Ghost elements have no background until you point at them: list rows, ghost and icon buttons, menu items, tree rows.

TokenWhat it colorsOne DarkOne Light
elementFilled controls at rest.#2e343e#ebebec
element_hoverFilled controls under the pointer.#363c46#dfdfe0
element_activeFilled controls while pressed.#454a56#cacaca
element_selectedA selected filled control (a segmented option, a chosen icon).#454a56#cacaca
ghost_hoverA row or ghost button under the pointer.#363c46#dfdfe0
ghost_activeA row or ghost button while pressed.#454a56#cacaca
ghost_selectedThe selected row of a list, tree, menu or tab.#454a56#cacaca
TokenWhat it colorsOne DarkOne Light
textBody text and labels.#dce0e5#242529
text_mutedSecondary text: descriptions, captions, inactive tabs.#a9afbc#58585a
text_placeholderPlaceholder text in empty inputs.#878a98#7e8086
text_disabledDisabled controls.#878a98#7e8086
text_accentLinks and highlighted text.#74ade8#5c78e2
iconIcons next to text.#dce0e5#242529
icon_mutedSecondary icons: ghost icon buttons, list icons.#a9afbc#58585a
accentThe brand color: primary (solid) buttons, switches, sliders, progress bars, checkboxes.#74ade8#5c78e2
on_accentText and icons drawn on top of the accent (inside a solid button or a solid badge).#1c2025#fafafa

Used by tint= (ui.badge, ui.callout, ui.button, ui.progress…), by toasts, validation messages and charts.

TokenWhat it colorsOne DarkOne Light
errorErrors, destructive buttons, invalid fields.#d07277#d36151
warningWarnings.#dec184#a48819
successSuccess messages, positive changes in ui.stat.#a1c181#669f59
infoInformation callouts (the accent by default).#74ade8#5c78e2
hintHints, the quietest callout.#788ca6#7274a7

For file trees, tabs and diffs (ui.tree, ui.diff_stat, the code editor’s gutter).

TokenWhat it colorsOne DarkOne Light
createdAdded files and lines.#a1c181#669f59
modifiedChanged files and lines.#dec184#a48819
deletedRemoved files and lines.#d07277#d36151
conflictFiles with conflicts.#dec184#a48819
ignoredIgnored files.#878a98#7e8086

For pz.code_editor, ui.terminal and code blocks.

TokenWhat it colorsOne DarkOne Light
editor_textCode text without highlighting.#acb2be#242529
line_numberLine numbers.#4e5a5f#a2a3a7
line_number_activeThe number of the line with the cursor.#d0d4da#242529
active_lineThe background of the line with the cursor.#2f343ebf#ebebecbf
selectionSelected text (also in inputs).#74ade83d#5c78e23d
scrollbarScrollbars.#c8ccd44c#2425294c
scrollbar_hoverA scrollbar under the pointer.#c8ccd480#24252980
search_matchSearch results in the editor.#74ade866#5c78e266
shadowShadows of menus, popovers and dialogs.#0000004d#00000026

These three are collections instead of single colors.

  • syntax: a dictionary from a highlighting name to a color, or to (color, "italic") / (color, "bold"). The main names are primary, comment, comment.doc, keyword, function, type, string, string.escape, number, boolean, constant, property, attribute, operator, variable, variable.special, punctuation, punctuation.bracket, tag, title and link_uri. A missing dotted name falls back to its first part (string.escape → string).
  • ansi: the terminal’s colors: black, red, green, yellow, blue, magenta, cyan, white, bright_black and dim.
  • players: a tuple of colors for avatars and collaborators; ui.avatar(index=n) and ui.facepile take the n-th one.
TokenWhat it colorsOne DarkOne Light
syntax.keyworddef, if, return...#b477cf#a449ab
syntax.functionFunction names.#73ade9#5b79e3
syntax.stringStrings.#a1c181#649f57
syntax.commentComments.#5d636f#a2a3a7
syntax.typeClasses and types.#6eb4bf#3882b7
syntax.numberNumbers.#bf956a#ad6e25
ansi.redRed text in the terminal (and so on for each ANSI color).#d07277#d36151
players.0The first avatar color (the accent by default).#74ade8#5c78e2
Token Default What it sets
radius 6.0 Corner radius of cards, dialogs and large surfaces (cards use radius + 2).
radius_sm 4.0 Corner radius of buttons, inputs, chips and list rows.
ui_font_size 14.0 The base size of interface text; a form’s Font size and the global style’s size set it.
buffer_font_size 14.0 Text size in the code editor.
name The name used by pz.themes.get and theme = "...".
appearance "dark" or "light"; theme.is_dark reads it.
t = pz.themes.get("One Dark")
t.accent # '#74ade8'
t.color("text_muted") # the same as t.text_muted; hex colors pass through unchanged
t.tokens() # every token as a dictionary
t.to_dict() # JSON-friendly, the format Theme.save writes

The names follow the theme format of the Zed editor, so themes made for it can be imported (see Creating themes). The Theme API lists every method.