Settings and Themes
Gamut's look comes from a theme, in the format every program built on the Xtk toolkit reads. The Settings tab chooses the theme and edits its file in a built-in editor, and chooses the colors of that editor. This page also describes what is in a theme file, including the colors of the measurement overlay.
1. The Settings tab
While the Settings tab is showing, the right end of the tab bar holds three radio buttons, Prefs, Main and Editor, and two buttons, Save and Reset. The radio buttons choose what the editor below shows; Main is chosen whenever Gamut starts.
| Choice | The editor shows | At the top right |
|---|---|---|
| Main | The file of the current theme. | Main Theme and a list of the themes. |
| Editor | The file of the chosen editor theme, in the editor_theme/ folder of Gamut's folder. |
Editor Theme and a list of the ten editor themes. |
| Prefs | gamut.conf in Gamut's folder: the names of the main theme and the editor theme, and Gamut's icon theme (below). |
The word Configuration. |
The editor shows line numbers and colors the sections, keys, values, comments, numbers and hex colors of the file. It has the usual editing keys, selection with the mouse and the keyboard, copy and paste, and undo.
- Choosing a theme in the Main Theme list applies it at once to the main window, the Design window and the Measurement Settings dialog, and the editor shows its file.
- Choosing an editor theme in the Editor Theme list recolors the editor at once, and while Editor is chosen the editor shows that theme's file. The ten are Chocolate, Dark (the first one), Dracula, Gruvbox Dark, Light, Liquibyte, Monokai, Nord, Solarized Dark and Solarized Light.
- Save writes the editor's text to the file and applies it at once, with no restart: for Main the theme, for Editor the editor theme's colors, for Prefs the themes that
gamut.confnames (as if chosen in the lists; a name that is not in a list is left as it was). - Reset fills the editor with the defaults and writes nothing until you press Save. For Main: a built-in theme's built-in text (with its overlay colors); any other theme's file as it was last saved, so unsaved edits are dropped. For Editor: the editor theme's built-in colors. For Prefs: the current choices.
A theme file in Gamut's themes/ folder, or an editor theme file, that another program changes while Gamut runs is applied at once. If the editor shows that file and holds no unsaved edits, it shows the new text too.
Both choices are kept in gamut.conf when Gamut closes, and used at the next start.
Icons. The line icon-theme= of gamut.conf (Prefs) chooses Gamut's icons: empty to follow every xtk program's choice (the theme line of ~/.config/xtk/icons.conf, which Unryu, Hanshi and Skein set in their Preferences), or "desktop" (the icon theme your desktop uses: the one it announces, else GTK's gtk-icon-theme-name, else KDE's), "builtin" (xtk's own one-color icons), or an installed icon theme's folder name (from /usr/share/icons or ~/.local/share/icons, such as Papirus-Dark). Save applies it at once. A theme's icons are drawn in its own colors, as GTK programs show them; where it has no icon for something, Gamut draws its own. Gamut follows a change of the desktop's theme, or of icons.conf, while it runs.
2. Where themes come from
An installed theme is never changed: saving it writes a copy into Gamut's own folder, which from then on is the one the list uses.
Fourteen themes come with Gamut: Chocolate, Dark (the first one), Ember, Forest, Gold, Graphite, Light, Midnight, Ocean, Rose, Rust, Slate, Teal and Violet. They are the built-in themes of the Xtk toolkit, the same in every Xtk program, and Gamut writes each one into ~/.config/gamut/themes/ (or $XDG_CONFIG_HOME/gamut/themes/ when XDG_CONFIG_HOME is a full path) when it is missing there. The list's names are the file names without .conf. A name in gamut.conf that matches no theme exactly finds one whose name differs only in capital letters; if gamut.conf names a theme that no longer exists, Gamut uses Dark.
To make your own theme, copy a file in ~/.config/gamut/themes/ under a new name, for example Mine.conf, change it, and choose it in the list. A file added to or removed from that folder shows in the list, or leaves it, at once.
3. What is in a theme file
[theme]
name = Dark
[colors]
window = #262629
window-text = #E0E0E0
accent = #4D99E6
[button]
background = linear-gradient(180deg, #3A3A40, #2A2A2E)
hover-border = #4D99E6
[button-widget]
border-radius = 4
[app]
overlay-measure-ok = #00D060
[theme]holds the theme'sname.[colors]holds the roles every widget follows:window,window-text,baseandbase-text(entries and lists),button,button-text,border,accent,accent-text,hover,active,muted,link,valid,invalid,tooltipandtooltip-text. A role left out is worked out from the others.- A section for each widget (
[button],[menu],[entry-hex],[slider],[checkbox],[notebook]...) sets that widget's own colors, over the roles. A background can also be a CSSlinear-gradient()orradial-gradient(), andhighlightandshadedraw a raised edge. [NAME-widget]sections (button, combobox, menubar, notebook, slider, spinbutton, swatch and zoom) hold sizes, borders and corners.[app]holds Gamut's own colors, those of the measurement overlay (below). Other Xtk programs ignore them.
Colors are written as #RRGGBB, or #RRGGBBAA with alpha; #RGB, rgb(), rgba(), and white, black and transparent are read too, and in the widget sections also six or eight digits without the #. Lines may be of any length. The built-in themes are written out with every color key, so the easiest way to learn the keys is to open one on the Settings tab.
4. The overlay's colors
The [app] section of a theme sets the colors of the measurement overlay. A theme in Gamut's own folder that lacks these keys gets them written in at the start, with the colors of the built-in theme of the same name (or of Dark), so they are always there to change.
| Key | Used for |
|---|---|
overlay-ruler-background, overlay-ruler-foreground, overlay-ruler-border |
The rulers. |
overlay-measure-ok |
Stored measurements, their labels and the list of the last six. |
overlay-measure-fail |
Measurements that fail the 8pt audit, and the lines between monitors. |
overlay-angle |
Angle arms and labels. |
overlay-caliper |
The line being measured, and the caliper badge. |
overlay-hud-border, overlay-hud-text |
The border and the label of the window under the pointer. |
overlay-spacing |
The spacing inspector. |
overlay-wcag-label |
The contrast check's badge. |
overlay-snap-ok |
The short messages. |
overlay-difference-label |
The "DIFF ON" badge. |
overlay-breakpoint |
Breakpoint lines and labels. |
overlay-help-foreground, overlay-help-background |
The on-screen list of keys. |
overlay-anchor, overlay-freeze-label |
Nothing at present: the overlay no longer draws them. |
5. The editor themes' files
Each editor theme has its own colors built in, and a file in the editor_theme/ folder of Gamut's folder (dark.conf, solarized_light.conf ...) that is written with those colors when it is missing. The file's [editor] keys are laid over the built-in colors. These are all the keys (the values here are only an example):
[editor]
background = #2E2E2E
text = #E0E0E0
selection = #4D7A99
selection_text = #FFFFFF
line_numbers_bg = #141414
line_numbers = #808080
cursor = #FFFFFF
section = #6699E6
key = #B380CC
value = #99CC99
comment = #808080
hex_color = #E5B24D
number = #E5994D
border = #4D4D4D
focus_border = #4D99E6
A key that is left out keeps the built-in color. Files from earlier versions, which all had the same text, are written again with each theme's own colors at the first start.
6. Known limitations
- Gamut writes
gamut.confagain from its two choices when it closes; any other line you add to it is not kept. - Installed themes (in the GTK theme folders) are not watched: a change to one is seen when you choose it again.
