mindfork mindfork

mindfork 0.12.0 — the app paints its own window, and a theme can be yours

mindfork 0.12.0 is out. One track in it changes how the app looks; one fix changes what a typo in the settings file can cost you; the rest are smaller.

Three ways of drawing

Until now the app drew only its text. The background was the terminal's, and so was the contrast: the dark theme was tuned on a near-black canvas and light on a near-white one, but a terminal with a maroon or a translucent background got the same colours, and nobody had measured those. There was also no way to turn styling off — a terminal that renders attributes badly, an e-ink panel or a screen reader got bold and colour regardless.

Settings → Interface → Colour mode now offers three:

ModeBackgroundColours
systemthe terminal'sas before
fullthe theme's ownthe theme's, held to a contrast floor
monochromethe terminal'snone — the terminal's two colours, no bold, italic or underline

system is the default and is exactly what the app has always done. In full the app paints the whole window itself, and each of the two built-in themes is held to a floor: every text colour at least 4.5:1 against the background and against a selected row alike, body text at least 7:1. Measured on the shipped palettes, three colours in dark and seven in light fell short of that on a selected row — secondary text, the key labels in the footer, comments in code — and each moved just far enough to clear it. The hues are the same; the text is a shade more legible, in system mode too. In a console driven by a probe, every one of the window's 3 600 cells carried the canvas through every screen and popup, and switching back to system gave the console its own background back.

In monochrome what the colours said is said with marks instead: keys are [Enter], the tab you are on is [Hotkeys], the selected row of a list has › before it, the feed's left bar tells your messages from the assistant's by its shape, markdown keeps its ** and its backticks. Only selected text and the matches of a search are inverted. With the NO_COLOR environment variable set the app starts in this mode; a mode chosen in the settings wins over the variable.

A theme of your own

A theme of the full colour mode is a file, data/themes/<name>.json, listed in Settings → Interface → Theme by its name. Only the background has to be in it. The colours you leave out are chosen to stay readable on your background — the built-in theme's colour, made lighter or darker only as far as it takes to clear the floor — and the colours you write are kept exactly as written, whatever their contrast. A theme of one line, {"canvas": "#002b36"} (Solarized's dark base), comes out with eleven colours taken as built in, six fitted and none below the floor.

Two commands go with it. mindfork themes export dark -o FILE writes a template with every colour named, and mindfork themes check shows each colour of a theme, where it came from and its contrast, without starting the app — Solarized's own body text, named in full, is reported at 5.61:1 on its base and 4.18:1 on a selected row, and drawn as written. Themes are read at start-up and travel with a backup.

One wrong value no longer costs the settings

A settings.json with a misspelt value — "theme": "drak", a number where a word belongs, a value written by a newer version — used to start the app on the defaults without a word, and the defaults were then saved over the file at start-up: every setting gone, the stored API keys with them. Measured on a default settings file, any of its 289 values would do it. Worse, mindfork backup run over such a file wrote the archive unencrypted, because through the defaulted settings the stored password read as "none".

The app now refuses to start instead. It names the file, the value, the values it would have accepted and the line, and changes nothing; profiles.json is checked the same way. backup, restore and stats find the password in the file regardless, so a settings file the app refuses can still be backed up first. And mindfork llama remove no longer removes a build it could not check the settings against — --force is the way round.

Smaller things

  • The input box's height is a setting — how many rows of text it grows to before it scrolls, from 1 to 50, 6 by default as before. However high it is set, the box never takes more than half the window.
  • Ctrl+← and Ctrl+→ stop at punctuation. From the end of test1, test2, the first press now stops before the comma, at the end of the word, and the next before test2; a run of marks is passed in one step. Selecting and deleting by word use the same stops, in every text field of the app.
  • Settings no longer mark a default value as changed: the • marker means what it says, and Del resets.

Two things are added to settings.json — the colour mode, written only once one is chosen, and the theme of the full mode — and a new themes/ folder in the data root, which a backup packs like locales/. Nothing is migrated, and 0.11.2 ignores both fields if you go back. The full list is in the changelog; downloads are on the releases page, and cargo install mindfork builds the same version from crates.io.