This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
xtk Themes
Palette is built on xtk, a small widget set for X11, and so are other programs. They all read one theme format: a theme made in Palette's xtk preview themes Palette itself, and any other program built on xtk. This page describes the xtk preview, the theme file with its roles and widget keys, gradients and bevels, where themes live, and Palette's own theme.
1. The xtk preview
Choose xtk in the Mockup's first drop-down. The preview is xtk's own widget gallery: every xtk widget, working, on ten pages, in every state it has. A page lays its sections out in as many columns as fit its width, and scrolls when they are taller.
| Page | Widgets |
|---|---|
| Buttons | Push, default, toggle and disabled buttons, a button's tooltip; check boxes (checked, mixed, three check styles, disabled); radio groups; combo boxes; spin buttons. |
| Text | Entries (text, placeholder, integer, decimal, hex with its swatch, password, read-only, a valid and an invalid one), labels (plain, bordered, copyable, disabled, wrapped), a text view with line numbers and highlighting. |
| Ranges | Sliders (plain, inverted, with ticks, stepped, pointer, without fill, disabled), progress bars (value, pulse, text, disabled) and scroll bars, each horizontal and vertical, all showing one value: move one and the rest follow. Gradient tracks (three stops, OKLCh, hue, alpha) both ways, each on its own. |
| Lists | A tree view (icons, sorting, a right-click menu) beside an editable data grid, in a split pane. |
| Rich text | The formatting toolbar and the editor: headings, lists, tasks, a table, code, math, an admonition, a footnote. |
| Color | Swatches to drag onto each other, the color wheel, the color picker, the magnifier, a gradient with its export, the color panel. |
| Data | CSV, JSON and XML read into a table and into Markdown. |
| Graphics | The icon set (searchable), the theme's roles, vector drawing, SVG. |
| Docking | A dock frame: tool windows to drag, float and stack, and a graph (its hub tinting the nodes near it; nodes two apart in the plain colors). |
| System | The popup menu, tooltips, the file and color dialogs, a message dialog, the clipboard, the tray icon, keyboard focus. |
Around the pages are the menu bar (its pill on the right says what just happened, such as "Copied", for a moment; in the preview it stays, so that it can be colored), a toolbar and the status bar.
The Style panel's Keep open or hovered buttons put up the popup menu (with Hover on, its first item hovered: menu - hover-background, menu - hover-color), the menu with its submenu, the tree's right-click menu, the menu bar with File open, a combo box's list (combobox - dropdown-hover-background, dropdown-hover-color), a tooltip (tooltip - background, tooltip - color, tooltip - border), a dialog, the status bar's message, the dock's drop outline, and a tool window's close button hovered. They also hold parts hovered: Tab (notebook - hover-background), Scroll bar (scrollbar - thumb-hover), Slider (slider - handle-hover-background, handle-hover-border), Spin arrow (spinbutton - button-hover-background) and List row (treeview - hover-background). What they put up stays until you press the button again.
Dropping colors
As in GTK3, every widget color is its own drop zone, named by the widget and its key: button - hover-background, entry-text - focus-border.
- A drop colors that key of that widget.
- A Shift+drop sets the role the key follows (see below), so every widget that follows it changes.
- The mouse wheel while dragging steps through that widget's other keys.
- The gradient swatch dropped on a background makes it a gradient.
The Style panel's states work too: Hover, Pressed, Checked, Selected, Disabled, Unfocused, Focus and Mixed put the gallery's widgets into that state (xtk has no Visited: its links have one color).
Presets and other themes
The Theme list has xtk's 14 presets, Chocolate, Dark, Ember, Forest, Gold, Graphite, Light, Midnight, Ocean, Rose, Rust, Slate, Teal and Violet, and the other themes in Palette's themes folder and the installed ones (see below), in alphabetical order. A preset opens Palette's own copy of it in the themes folder, so a preset you have changed and saved there opens as you left it.
2. The theme file
An xtk theme is one .conf file:
[theme]
name = My Theme
[colors]
window = #2D2D2D
window-text = #E5E5EA
button = #2A2A2E
accent = #598CE5
[button]
background = linear-gradient(180deg, #35353B, #222226)
hover-background = linear-gradient(180deg, #4B4B53, #36363D)
highlight = #FFFFFF16
shade = #00000050
[app]
editor-keyword = #CC7832
How an xtk theme is built: roles that every widget follows, and each widget's own keys over them.
[colors]: the roles
Every widget color follows one of 17 roles:
| Role | What it colors |
|---|---|
window, window-text |
Window backgrounds, and the text on them |
base, base-text |
Fields: entries, lists, text views |
button, button-text |
Buttons, combo boxes, tabs, headers |
border |
Borders and frames |
accent, accent-text |
The selection, focus, checked marks, a slider's fill |
hover, active |
What is under the pointer; what is pressed, open, or the current tab |
muted |
Secondary text, line numbers, icons |
link, valid, invalid |
Links; valid and invalid entries |
tooltip, tooltip-text |
Tooltips |
A role left out is worked out from the others, for a dark theme as for a light one, so a theme can be as short as window and accent.
A color is written in any of the usual forms: #RGB, #RRGGBB, #RRGGBBAA (the last two digits are the opacity), rgb(), rgba(), or white, black and transparent. In the widget sections, six or eight digits without the # work too. Lines may be of any length.
Widget sections: single keys
Any other section sets keys of one widget over the roles, with the names xtk's own configuration uses: [button] hover-border, [notebook] active-background, [treeview] selected-background. What Palette saves is the roles, and every key: the ones you colored on their own as you set them, the rest as the roles give them, so that the file reads the same in every program and every xtk version.
xtk has 196 color keys in 29 sections. Every color a widget draws is one of them; nothing is worked out behind the theme's back (only a disabled widget's dimmed colors and a graph's tinting are blends of its keys). Some you may look for:
| Section | Keys |
|---|---|
[statusbar] |
background, color, border (the line along its top), message-background, message-foreground (its pill) |
[datagrid] |
background, color, alternate-background (every other row), header-background, header-foreground, selected-background, selected-foreground |
[graph] |
background, node-background, node-foreground, edge, selected-background, neighbor-background, hub-background, focus-border |
[tooltip] |
background, color, border; its font-size is in pixels, as every other section's is |
[combobox] |
... dropdown-background, dropdown-hover-background, dropdown-hover-color (its open list, and the item under the pointer in it) |
[treeview] |
... inactive-selected-background, inactive-selected-foreground (the selection while the tree does not have the keyboard) |
[menu], [menubar], [tray-menu] |
... hover-color (the hovered item's text; left out, it is the section's color) |
[menu], [menubar] |
... active-background (the item whose submenu is open; the menu bar's open title) |
[menu], [menubar] |
... border (the frame round a menu, which has round corners, and round the menu bar), hover-border (an outline round the hovered item; the presets draw it in the accent color) |
[spinbutton] |
... hover-background (under the pointer), button-color (the + and − signs), button-hover-background (an arrow under it) |
[checkbox], [radiobutton] |
color (the label; a check box's old name for it, foreground, is read too), check-foreground, fill-foreground (the mark); and sizes: box-size or circle-size (the box grows to the label's font height), border-width, a check box's border-radius, and label-gap |
[menubar] |
... rail-background, rail-foreground (the pill) |
[toolwindow] |
... titlebar-border, badge-background, badge-foreground |
[textview] |
... highlight (rich text's ==highlighted==) |
[scrollbar] |
track, thumb, thumb-hover |
[slider] |
... border (a frame around it, border-width pixels wide, with border-radius), track-background and track-border (the groove), fill-background (the filled part of it), handle-background (the handle's fill; handle-hover-background under the pointer), handle-border, handle-hover-border, handle-focus-border, handle-foreground (the grip, a line across the handle); and sizes: track-height, handle-width, handle-height |
3. Gradients and bevels
xtk widgets are flat, but a theme can give them depth:
- Any background key takes a CSS
linear-gradient()orradial-gradient(): angles in deg, turn or rad, orto bottom; stops with positions; hex,rgb(),rgba()and named colors. Every widget draws it: buttons, entries, labels, check boxes and radio buttons, spin buttons, combo boxes and their lists, sliders (frame, track, fill and handle), progress bars, scroll bars, tabs, the tab bar and pages, text views (with line numbers, the selection and rich text's highlight), tree views and data grids (rows, alternate rows, headers, selections), the graph and its nodes, menus and the menu bar, tooltips, the status bar, tool windows (content, header, icons, badge, scroll bars), split pane dividers, the dock frame and its drop outline, and the window behind them ([main] background, in the gallery). A background that fills a whole area, such as a page or a panel's content, is one gradient across it, and scrolls with it. highlightandshadein a widget's section draw a light top and left edge and a dark bottom and right one: a bevel. In Palette they are the Style panel's other properties for xtk.
In Palette, the gradient swatch dropped on a background writes such a gradient. A flat, darker hover color is a theme too: it is just a color.
[app]: a program's own colors
Colors that only one program uses, an editor's syntax colors for example, go into [app]. Other programs ignore them, and keep them when they save the theme.
4. Where themes live
Each program built on xtk has its own themes folder and reads only its own: Palette's is ~/.config/palette/themes/ ($XDG_CONFIG_HOME/palette/themes/ when that variable is set to a full path, one that starts with /), and another program's is in its own configuration folder. Palette writes xtk's 14 presets into its folder as starting points, with every key. A preset that is missing is written again at the next start, but an existing file is never written over, so a preset copy written by an older version keeps its older colors. Delete it, and the current one is written next time.
To use a theme in another program, copy its file into that program's themes folder. Like every theme Palette makes, it is yours to keep anywhere: Save As writes wherever you choose, and File > Open reads an xtk theme from anywhere.
Installed themes
Every program also lists the xtk themes installed the way GTK themes are, in a theme folder's xtk/:
~/.themes/Nordic/xtk/Nordic.conf
~/.local/share/themes/Nordic/xtk/Nordic.conf
/usr/share/themes/Nordic/xtk/Nordic.conf
They are read only. A program's own folder wins over a theme of the same name, and saving makes your own copy. Save All As writes a theme folder with its xtk/ already in it.
5. Palette's own theme
View > Theme lists the themes in Palette's themes folder and the installed xtk themes. Choosing one restyles all of Palette at once, every panel and its hints, with no restart. The choice is [main] theme in palette.conf. A theme saved into the themes folder joins the list, and when the theme in use is saved again (from the xtk preview, say), Palette shows the change at once.
