Files
magpie/internal/settingsapi
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
..