chen2652 (Discord #help) reported that Open Design's icon is almost invisible
in dark mode, with no browser dark-mode extension on. The icon is the plugin's
own picture, open-design.ai/favicon.svg: a single fill, #26251E, drawn as an
<img> on the dark card (#232327).
Now icon() judges each picture once, after the picture's own load, so lazy
loading is kept (#909). The result is cached per src. If every opaque pixel
of a picture is one tone (the range of each channel is at most 24), and that
tone is near-black (every channel at most 72) or near-white (every channel at
least 224), the picture is replaced by maskSpan, the way a mono logo is drawn:
a mask in the text colour. This holds on any ground, Omarchy's themes
included. It covers user pictures (file:), plugin pictures, and bundled
-color and PNG icons.
Audit: every bundled picture icon, plus the plugin registry's pictures, was
measured in CIELAB against #232327 and #fff. Two were invisible in dark mode:
Open Design's plugin picture and bundled voyage-color.svg (#012E33, in the
provider icon picker). Both are now masks. Multi-tone and tiled logos stay as
they are (pipellm, zcode, mothx, deepinfra and others: low contrast in places
but readable). Mono icons were masks already.
Test: icon-one-tone.test.cjs, with the real favicon bytes in fixtures/.
- It draws every picture logo on the dark and the light card and measures,
on a screenshot, how much of each stands apart from the ground.
- It opens Open Design's Installed row on the Plugins page and checks that it
is a mask in the icon's text colour and visible in both themes: 5
languages, 980px and 420px, Chromium and WebKit.
icon-url and icon-url-saved served a plain black square as the fetched
picture. That square is one tone, so it is now a mask. Their fixture is now a
coloured tile, like the letter icons the server makes (favicon.go).
Run (on mote unless named):
- icon-one-tone: 48/48. The 14 icon/theme GUI files (icon-tile,
plugin-own-icon, mono-icon-redraw, plugin-registry-icon,
models-add-and-icons, market-icon-corners, request-provider-icon,
routing-client-icons, routing-log-icons, tray-logos, api-key-theme,
icon-url, icon-url-saved, icon-one-tone): green in both engines.
- go test ./internal/gui -run 'Budget|I18n|Asset', gofmt -l,
GOOS=linux go vet -tags nogui and GOOS=windows go vet of ./internal/gui:
all clean, and no size budget was raised.
- A whole GUI suite on Linux (WSL) was cut off when the SSH connection to
xiaomi-gpu dropped, after about 9,160 passes and 277 reds:
- 40 of the reds were icon-url and icon-url-saved (fixed above).
- The rest were in 75 other files. Those 75 files were run on mote with
this change and at origin/main 76f00399c: 196 reds with the change and
208 at main, in the same files.
- The one file red only with the change, copilot-ghe (webkit zh,
"route.fulfill: Target page ... has been closed"), is #1949's teardown
race and passes 6/6 alone.
- Every file red at main already has an open issue except
redact-words-list, filed as #5288 and fixed by a18ff505b before this
rebase.
- At the pushed head (a18ff505b + this commit): the budget/vet/gofmt checks
above, the 14 icon files, redact-words-list and copilot-ghe, rerun.
Broken by hand: with both toneCheck(img) calls commented out,
icon-one-tone fails 46 of 48. voyage-color shows 0.0% ink in dark, and the
Open Design row stays an <img>. Before and after screenshots of the row in
both themes were taken from the same test.
Not tried: the real desktop app (Wails, WebKitGTK) and a real install of the
Open Design plugin. The page was driven with the API faked and the real
favicon bytes. The whole GUI suite has not had a complete run.
hoobnn on Discord #general: a custom provider's icon given by an image
URL was neither fetched nor applied, and on editing it again the URL
was gone.
Cause: the Image URL… box (1dc22a37c) sent its address with Enter only.
An address typed and then saved, or left by clicking elsewhere, was
never fetched, so Save sent the old icon ("generic"). And nothing kept
the address: the box went away after a fetch that worked, and the
provider had no field for it, so a reopened editor showed none.
Now:
- The box has a Use button (an existing string, in every language), and
leaving it fetches too. Save fetches an address typed and not fetched
yet, then saves with the picture; one that can't be used keeps the
editor open with the note why, and saves nothing.
- Provider.IconFrom (iconFrom) records the address the uploaded picture
came from. /api/providers gives it back, the editor opens with it in
its box, a save that doesn't name the icon (CLI, TUI) keeps both, and
provider.Save drops it when Icon isn't an uploaded picture (a built-in,
Default, the letters, a chosen file or the site's icon clear it in the
editor too). It is a record only, never fetched again.
- The fetch itself is unchanged: POST /api/icons/url through
guardClient (public addresses only), https only, MaxIcon 1 MB, type
sniffed. Remote images are never loaded by the page itself.
Siblings: iconPicker is the only editor with an icon address; the
import link's iconUrl is fetched on confirm (fetchImportIcon) and stays
import-only.
Core script budget: this adds ~1KB to app.js; it fits the unchanged
1,533,105 (now 1,532,840) by cutting four long comments in app.js
(text-cut tooltips, rowOwnRect, modalHold, modalDepth) to two lines
each. No raise.
Run at this tree (based on origin/main 0516c18ca), on mote:
- GUI: icon-url-saved.test.cjs (new) and icon-url.test.cjs, Chromium and
WebKit, 420 and 1100 wide, en/zh/zh-TW/ja/de: 40 of 40 ok (the
existing test now expects the box to stay with the working address).
- Broken by hand: Save's flush removed -> icon-url-saved red in
Chromium ("Save didn't send the fetched picture", actual 'generic',
hoobnn's case); draftOf without iconFrom -> red in WebKit (the box
with the address never shows on reopening).
- go test ./internal/gui ./internal/provider: provider ok; gui ok but
for three reds that fail the same on a fresh origin/main 586b59fe7
copy, each already filed: TestSettingsSaveKeepsWhatItDoesNotSend
(BusyLoad, #4739), TestMainWindowCorners/macOS_26_SDK (#3949) and
TestColdTurnsTaken in the full package run (#4510; it passes alone
on main). TestCoreScriptBudget ok.
TestProviderSaveKeepsIconFrom (new) red with the save merge's IconFrom
keep removed ("a save without the icon lost it"), green restored.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./...; go build, linux nogui and windows
builds: ok.
Not yet at push (the owner's ship-at-once rule): the whole GUI suite
(mote was busy with another session's full GUI run) and the full Go
suite (running on the Linux box); both run after the push, and any red
they show is fixed or filed in its own commit.
Not tried: a real image URL against the real backend in the app; the
fetch path is unchanged from 1dc22a37c, which was.
usrname1833 on Discord: many sites serve no {HOST}/favicon.ico, so a custom
provider's icon came out wrong or missing, with no way to give it one.
The provider editor's icon row now has Get icon, a pull-down that opens the
app's own menu (no native select) headed Icon:
- Automatic: the site's icon from the base URL, as before.
- Image URL…: a url box under the row, focused; Enter fetches the address,
Escape puts it away and gives focus back to Get icon.
- Letter icon: the name's first letters on a coloured tile (letterIcon).
POST /api/icons/url (provider.IconFromURL) fetches the typed address the way
a favicon is fetched: guardClient (public addresses only), iconURL (https,
public host, no userinfo), fetchIcon's 15s timeout, MaxIcon 1 MB and the
type sniffed to PNG/JPEG/GIF/WebP/ICO/SVG. An address that can't be used
gives the letter tile with a warn note saying why, and the box stays for
another try. The old From the website button and its two strings are gone;
eight new strings in zh, zh-TW, ja and de. app.js +1,484 bytes to
1,309,847 (budget 1,316,874), core 1,534,839 (1,539,856); no budget raised.
Run at this tree (rebased on origin/main e484b1e93), on mote:
- gofmt -l clean; go vet ./internal/provider ./internal/gui on darwin,
linux (nogui) and windows; go build ./..., linux nogui and windows builds.
- go test ./internal/provider: ok (TestIconFromURL new: a PNG kept; HTML,
404, over 1 MB and a stalled server each give the letters with why; http,
loopback, localhost and userinfo addresses refused; an empty name takes
the base's site label).
- go test -run "Budget|Icon|Favicon|Provider|Settings" ./internal/gui:
TestCoreScriptBudget ok; TestSettingsSaveKeepsWhatItDoesNotSend red, the
same at a clean e484b1e93 (#4514).
- node --test icon-url (new), models-add-and-icons, i18n-keys: 27 of 28.
icon-url is Chromium and WebKit x 420 and 1100 x en, zh, zh-TW, ja, de,
20 of 20 (menu, posted bodies, warn note, Escape focus, no scroll, no
spill at 420, Save sends the icon). The one red is i18n-keys' "Unmarked"
in plugins/routing, the same at a clean e484b1e93 (#4524).
Screenshots of the menu and the warn note checked in both engines.
Broken by hand: no letter fallback on a failed fetch -> TestIconFromURL red
('"" isn't stored'); the exported path skipping iconURL -> red for all four
refused addresses; icon-url.test.cjs on main's app.js and i18n.js -> 0 of
10 in Chromium (no Get icon).
Not tried: a real image address on a live site from the built app, and the
whole GUI suite (mote was running another session's full suite).