Make menus and hover fills translucent over a background image

With a background image, menus use the surface transparency of Appearance
(82% by default) instead of at least 92%, and they keep the blur.
Hovered rows and controls in the work area, hovered menu rows, and the
workspace button use the new --rs-hover-bg token. With an image, it is a
6% veil of the strong text color. The image stays visible, and the hover
shows over light and dark image areas. Without an image, nothing changes.

Silver Serpent dim text is now #c2c6cc. It keeps 4.5:1 contrast on a
hovered row over a white image.

UI-061 replaces the image rule of UI-043. Card 05b9bfa1.
This commit is contained in:
Knotty Wyvern
2026-10-30 13:38:47 -07:00
parent b2993e81a3
commit 9fc1490988
30 changed files with 90 additions and 46 deletions
+19 -6
View File
@@ -1,7 +1,7 @@
// The native Background feature (src/lib/features/background/): a folder slideshow with mocked host commands, a fade,
// reduced motion, Next and Pause from the command palette, the targets, menus at 92% with an image and opaque with
// Background off, a browser window, the settings section in both themes and at 360 pixels, the image source,
// and the first-start migration from seeded plugin settings and from a seeded image.
// reduced motion, Next and Pause from the command palette, the targets, translucent menus and hover fills with an image,
// opaque menus and hover fills with Background off, a browser window, the settings section in both themes and at
// 360 pixels, the image source, and the first-start migration from seeded plugin settings and from a seeded image.
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import path from "node:path";
@@ -17,7 +17,7 @@ const PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwM
function folderCommands(test) {
const snapshot = { profiles: [{ id: "user", name: "User" }], tabs: [], bookmarks: [], settings: { search: "duckduckgo", adblock: true, linkDestination: "internal", personalRules: "", homepage: "", filterLists: [] } };
return {
...test.workspace({ root: "C:\\background-feature", files: { "note.md": "# Note\n\nText." } }),
...test.workspace({ root: "C:\\background-feature", files: { "note.md": "# Note\n\nText.", "other.md": "# Other" } }),
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
"plugin:window|is_maximized": () => false,
spelling_menu_install: () => null,
@@ -57,6 +57,13 @@ async function command(page, title) {
await palette.getByRole("button").filter({ hasText: title }).first().waitFor();
await page.keyboard.press("Enter");
}
// The open file shows the selection tint, so the hover check uses the other file.
async function hoverBackground(page) {
const row = page.locator('[data-tree-rel="other.md"]');
await row.hover();
return row.evaluate(node => getComputedStyle(node).backgroundColor);
}
async function menuBackground(page) {
await page.locator('[data-tree-rel="note.md"]').click({ button: "right" });
const menu = page.getByRole("menu", { name: "File actions", exact: true });
@@ -111,14 +118,20 @@ await runSmoke("features/background", async ({ browser }) => {
assert.equal(await main.locator(".workarea-background").evaluate(node => node.getAnimations({ subtree: true }).length), 0, "Reduced motion has no fade");
await main.emulateMedia({ reducedMotion: "no-preference" });
// With an image, menus are at least 92% opaque and blur it (UI-043).
assert.match(await menuBackground(main), /0\.92/);
// With an image, menus use the surface transparency (82% by default) and blur it. Hover fills and the workspace button
// are a thin veil, so the image stays visible (UI-061).
assert.match(await menuBackground(main), /0\.82/);
const translucent = /(\/ 0\.06\)|, 0\.06\))$/;
assert.match(await hoverBackground(main), translucent, "A hovered row keeps the image visible");
assert.match(await main.locator(".workspace-button").evaluate(node => getComputedStyle(node).backgroundColor), translucent, "The workspace button keeps the image visible");
await main.screenshot({ path: path.join(output, "hover-over-image.png") });
// Targets: only the boards removes the workspace frame. The frame of all boards stays for Project Management.
await main.evaluate(() => window.__TEST__.writeSettings("background", { ...window.__TEST__.settings("background"), targets: ["pm-all"] }));
await main.waitForFunction(() => document.body.style.getPropertyValue("--rs-background-image") === "");
assert.equal(await main.evaluate(async () => !!(await import("/src/lib/plugins/backgrounds.ts")).backgroundHub.get("pm-all")), true);
assert.match(await menuBackground(main), /^rgb\(/, "Without a workspace image, menus are opaque");
assert.match(await hoverBackground(main), /^rgb\(/, "Without a workspace image, hover fills are opaque");
await main.evaluate(() => window.__TEST__.writeSettings("background", { ...window.__TEST__.settings("background"), targets: ["app"] }));
await waitForChange(main, "");