datarig themes
The setting theme (:set theme=<name>, or the settings screen, Space ,) names a built-in theme or a theme file. A theme file is themes/<name>.toml next to the config file ($XDG_CONFIG_HOME/datarig/themes/, else ~/.config/datarig/themes/); its name is ASCII letters, digits, - and _ (at most 64), and never a built-in theme’s.
Built-in themes: terminal, dark, light, high-contrast, catppuccin, catppuccin-latte, catppuccin-mocha, tokyo-night, tokyo-night-day, tokyo-night-night, gruvbox, gruvbox-light, gruvbox-dark, nord, dracula.
The file
extends names the built-in theme the file starts from (terminal without it). [colors] sets colour tokens and [styles] style tokens; a token the file does not set keeps the value of the theme it extends, and a style it sets replaces that one whole. The dimming of the screen behind a dialog is not a token: it is the extended theme’s. An unknown token, colour or modifier is an error with its line, and the app then draws with terminal and says why.
- A colour is
#rrggbb, an ANSI name (black,red,green,yellow,blue,magenta,cyan,white,bright-black,bright-red,bright-green,bright-yellow,bright-blue,bright-magenta,bright-cyan,bright-white) ordefault(the terminal’s own). - A style is
{ fg = <color>, bg = <color>, modifiers = [...] }, each part optional; what it leaves out is not set. - Modifiers:
bold,dim,italic,underlined,reversed,crossed-out.
# themes/mine.toml, used with theme = "mine"
extends = "dark"
[colors]
accent = "#89b4fa"
warning = "yellow"
[styles]
selection = { bg = "#45475a", modifiers = ["bold"] }
syn_comment = { fg = "bright-black", modifiers = ["italic"] }
Writing a theme file
:theme copy <from> <name>writesthemes/<name>.tomlwith every token of the theme<from>(a built-in theme or a theme file; a family such ascatppuccinas the variant drawn now) set to its value, each under a comment saying what it colours.extendsnames the built-in theme<from>starts from, for the dimming behind dialogs; every token is in the file, so it stands on its own.:theme new <name>writesthemes/<name>.tomlextending the current theme when it is built in, elsedark, with every token commented out and showing the value it takes from there: remove the#in front of a key to set it.- On the settings screen,
con the theme row copies the theme shown there (the one being previewed, else the current one) and asks for the new name.
Each writes a new file and never replaces one: a name that is taken, that is not a valid file name, that is a built-in theme’s or a Windows device name such as nul (ignoring case) is refused. The themes folder is created when it is missing. Then datarig draws with the new theme, saves theme = "<name>" to the config file and shows the file’s path.
:theme update [<name>] adds to the theme file <name> (the current theme without one) the tokens it does not list, such as tokens added after it was written: each under its description at the end of its section, commented out with the value it takes now. No line of the file changes, and the file is replaced only when it reads exactly as before; the theme drawn and the config file stay as they are. A theme file that does not list every token is said once in the status line when it is used, and again only when the tokens it does not list change.
Colours ([colors])
| Token | What it colours |
|---|---|
bg | The background of the panes: explorer, editor, results. |
surface | The background of dialogs, popups, menus, the command line and the status bar. |
surface_alt | A second surface: every other row of the result grid, form fields and buttons. |
edit_inserted_row | The background of a new row of the result grid, not applied yet: every cell, the separators and the row’s number. Its values, its defaults (muted), the mark of a cell that needs a value and the gutter’s marks must read on it; the cursor and a selection stand apart from it. |
border | Borders and rules between panes and around dialogs. |
accent | The main accent: the focused pane’s border, dialog borders, labels and names to notice. |
accent_warm | The warm accent: values on the settings screen, an open transaction, keys in menus. |
fg | Body text. |
fg_muted | Secondary text: descriptions, labels and hints. |
fg_dim | Faint text: placeholders, empty lists and notes such as a database’s default. |
current_stmt_bar | The bar in the editor’s gutter next to the statement a run would take. |
running_stmt_bar | The bar and the spinner in the editor’s gutter next to the statement that runs now. |
success | Success: rows a run returned, a connected tunnel, a success message. |
warning | Warnings. |
error | Errors. |
null_fg | NULL in the result grid and the inspector. |
key_pk | The mark of a primary key column. |
key_fk | The mark of a foreign key column. |
key_uq | The mark of a unique key column. |
mode_normal | The background of the status bar’s mode badge in Normal mode. |
mode_insert | The background of the mode badge in Insert mode. |
mode_visual | The background of the mode badge in Visual mode. |
mode_command | The background of the mode badge while the command line is open. |
mode_fg | The text of the mode badge (bold, on the mode’s colour). |
chart_1 | The first series of a chart. |
chart_2 | The second series of a chart. |
chart_3 | The third series of a chart. |
chart_4 | The fourth series of a chart. |
chart_5 | The fifth series of a chart. |
chart_6 | The sixth series of a chart. |
Styles ([styles])
| Token | What it styles |
|---|---|
selection | The selected row or item, and the grid’s cursor cell. |
range | Cells and headers of a selected range in the result grid (the cursor’s cell keeps selection). |
cursor_line | The row under the cursor of an unfocused list or plan, the editor’s line, and (its background) the chart’s cursor while focused. |
grid_cursor_row | The result grid’s cursor row (its bg): every cell, the separators and the row’s number, and every row of a selected range of cells or of whole rows. Keep it subtle: apart from bg and surface_alt (the alternate rows), and from selection (the cursor’s cell), range and hover, with body and muted text reading on it. A file that leaves it out but sets bg or selection gets, when both are RGB, the selection blended into its bg. |
grid_cursor_header | The header of the result grid’s cursor column (both lines; patched over the header). Keep it apart from surface (the header) and range (the headers of selected columns), with body and muted text and the key marks reading on it. A file that leaves it out but sets surface or selection gets, when both are RGB, the selection blended into its surface. |
hover | What is under the mouse pointer: a list row, a grid cell, a tab, a button. |
yank_flash | Cells copied from the result grid, for a moment after the copy was sent to the clipboard (set fg and bg: it covers the cursor’s cell too). With RGB colours it fades back into each cell’s own colours; with terminal colours it goes off at once. |
current_stmt | A faint tint behind the statement a run would take. |
running_stmt | A tint behind the statement that runs now. |
run_hint | The hint after a statement’s last line that says what its last run did. |
syn_keyword | SQL keywords. |
syn_function | SQL function names. |
syn_string | SQL strings and dollar-quoted bodies. |
syn_number | SQL numbers. |
syn_comment | SQL comments. |
syn_operator | SQL operators and punctuation. |
syn_identifier | SQL names, parameters and variables. |
syn_quoted_ident | SQL quoted names. |
syn_exec_comment | The opening and closing of a MySQL executable comment (/*! … */). |
search_match | A match of the editor’s search on the lines on screen. |
match_paren | The bracket matching the one at the editor’s cursor (not drawn yet). |
read_only_mark | The mark of read-only rules (its fg): the lock on a profile’s row and tabs, and the rule’s words. |
danger_mark | The mark of something that changes or deletes data, or of a production profile (not drawn yet). |
plan_hot | The plan nodes that take the most time, in every view of a query plan and its summary. |
plan_misestimate | How far a plan node’s estimated rows are from the actual ones, in the plan, its summary, detail and funnel. |
size_warm | Explorer size estimates of 1 MiB or more (with five levels: 100 MiB or more). |
size_hot | Explorer size estimates of 1 GiB or more (with five levels: 10 GiB or more). |
size_mild | With five size levels, explorer size estimates of 1 MiB or more. |
size_heated | With five size levels, explorer size estimates of 1 GiB or more. |
tab_active | The active tab’s fill (its bg; the alternate surface without one). An fg replaces every text colour on it but the environment’s badge (a connected tab’s number becomes a chip of its profile’s colour); without one the tab’s colours stay, made to read on it. A file that leaves it out but sets bg or accent, both RGB, gets that accent blended into that bg; else the fill of the theme it extends stays. |
grid_match | A cell of the result grid that the grid’s search matches (the whole cell is tinted: its value may be cut). Keep it apart from the selection, a selected range, the alternate rows, the hover and the copy flash. |
grid_match_current | The grid’s cursor cell while it is a match of the grid’s search. |
edit_changed | A cell of the result grid changed and not applied yet (its text: the cell keeps its background, so it must read on the alternate rows, the selection and a selected range). |
edit_pending | How many changes of a result are pending, on the result tab strip and the hint line. |
edit_inserted | The cells of a new row of the result grid, not applied yet (their text: the cell keeps its background, so it must read on the alternate rows, the selection and a selected range). |
edit_deleted | A row of the result grid to be deleted, not applied yet (its text; crossed out, so it shows without colour). |
edit_applied | A value of the result grid an Apply wrote, until the query runs again (its text: the cell keeps its background; italic, so it shows without colour). |
edit_invalid | A value a paste put in a cell of the result grid that its column does not take, not applied yet, and a new row’s cell that needs a value its column has no default for (its text: the cell keeps its background; underlined, so it shows without colour). |