Make menus opaque and redesign the core palettes

Phase 5a-3. The owner chose candidate B of each palette.

- Menus are opaque (UI-043, replaces UI-013). With a background image,
  menus are at least 92% opaque and blur the image. Submenus show as
  manual popovers in the top layer, so the blur cannot clip them.
- In a light palette, the page is the lightest surface, and the side
  panes have a slight tint (UI-044).
- RuneStone uses neutral surfaces and the rune cyan of the app icon.
  Claude Dark uses the layout of the Claude app. Claude Light uses a
  white page with brand Light panes and a darker orange for text.
  Sakura uses Petal Veil for active rows.
- All five core palettes pass every readability rule. A text role keeps
  the hue of its source and changes only its lightness.
- The accent-text rule also checks accent-2, because inline code in
  Read uses it as text.
- The root token defaults match RuneStone Dark.

pnpm check passes. pnpm test: 447 pass, 5 todo, 0 fail. Full smoke
suite: 92 passed, 2 known. editor/markdownPaste and tables/formulas
failed one time and passed on retry. workspace/manageTemplates fails
about half of its runs, also on the previous commit: the tree menu
rebuilds when the template list reloads, and the open submenu closes.
This commit is contained in:
Knotty Wyvern
2026-10-28 16:47:55 -07:00
parent 5bd616d7fd
commit 445d0200b2
18 changed files with 156 additions and 71 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
import type { BackgroundFrame } from './backgroundContracts.ts';
const positions = ['center', 'top left', 'top', 'top right', 'left', 'right', 'bottom left', 'bottom', 'bottom right'];
const properties = ['--rs-background-overlay', '--rs-background-image', '--rs-background-position', '--rs-background-size', '--rs-background-layer-sizes', '--rs-background-layer-positions', '--rs-background-previous-layer-sizes', '--rs-background-previous-layer-positions', '--rs-background-previous-image', '--rs-background-previous-position', '--rs-background-previous-size', '--rs-background-transition-image', '--rs-workarea-sidebar-bg', '--rs-workarea-editor-bg', '--rs-workarea-surface-opacity', '--rs-workarea-plugin-bg'] as const;
const properties = ['--rs-background-overlay', '--rs-background-image', '--rs-background-position', '--rs-background-size', '--rs-background-layer-sizes', '--rs-background-layer-positions', '--rs-background-previous-layer-sizes', '--rs-background-previous-layer-positions', '--rs-background-previous-image', '--rs-background-previous-position', '--rs-background-previous-size', '--rs-background-transition-image', '--rs-workarea-sidebar-bg', '--rs-workarea-editor-bg', '--rs-workarea-surface-opacity', '--rs-workarea-plugin-bg', '--rs-menu-bg', '--rs-menu-active-bg', '--rs-menu-backdrop'] as const;
function validImage(frame: BackgroundFrame) {
return frame && typeof frame.url === 'string' && /^blob:[^\s"'\\()]+$/.test(frame.url)
@@ -107,6 +107,9 @@ export class BackgroundHub {
body.style.setProperty('--rs-workarea-editor-bg', 'var(--rs-image-editor-bg)');
body.style.setProperty('--rs-workarea-surface-opacity', 'var(--rs-surface-opacity, 82%)');
body.style.setProperty('--rs-workarea-plugin-bg', 'var(--rs-transparent-plugin-bg, transparent)');
body.style.setProperty('--rs-menu-bg', 'var(--rs-image-menu-bg)');
body.style.setProperty('--rs-menu-active-bg', 'var(--rs-image-menu-active-bg)');
body.style.setProperty('--rs-menu-backdrop', 'var(--rs-image-menu-backdrop)');
body.style.setProperty('--rs-background-transition-image', frame.previous ? currentImage : 'none');
body.style.setProperty('--rs-background-previous-image', frame.previous ? image(frame.previous).image : 'none');
body.style.setProperty('--rs-background-previous-position', frame.previous?.position ?? frame.position);
+3
View File
@@ -97,6 +97,9 @@ function applyBackgroundSurfaces(root: HTMLElement, hasImage: boolean) {
root.style.setProperty('--rs-workarea-editor-bg', hasImage ? 'var(--rs-image-editor-bg)' : 'var(--rs-bg)');
root.style.setProperty('--rs-workarea-surface-opacity', hasImage ? 'var(--rs-surface-opacity)' : '100%');
root.style.setProperty('--rs-workarea-plugin-bg', hasImage ? 'var(--rs-transparent-plugin-bg)' : 'var(--rs-bg)');
root.style.setProperty('--rs-menu-bg', hasImage ? 'var(--rs-image-menu-bg)' : 'var(--rs-bg-elevated)');
root.style.setProperty('--rs-menu-active-bg', hasImage ? 'var(--rs-image-menu-active-bg)' : 'var(--rs-bg-active)');
root.style.setProperty('--rs-menu-backdrop', hasImage ? 'var(--rs-image-menu-backdrop)' : 'none');
}
async function applySavedBackground(root: HTMLElement, background?: Appearance['newTabBackground']) {
const id = background?.imageId;
+1 -1
View File
@@ -42,7 +42,7 @@ export const DISTINCT_DISTANCE = 0.1;
export const RULES: readonly Rule[] = [
{ id: 'text', kind: 'contrast', foregrounds: ['text', 'text-dim', 'text-strong'], surfaces: ['bg', 'bg-elevated', 'bg-active', 'selection'], min: 4.5 },
{ id: 'accent-text', kind: 'contrast', foregrounds: ['accent', 'link'], surfaces: ['bg', 'bg-elevated', 'bg-active'], min: 4.5 },
{ id: 'accent-text', kind: 'contrast', foregrounds: ['accent', 'accent-2', 'link'], surfaces: ['bg', 'bg-elevated', 'bg-active'], min: 4.5 },
{ id: 'status-text', kind: 'contrast', foregrounds: ['error', 'warn', 'ok'], surfaces: ['bg', 'bg-elevated'], min: 4.5 },
{ id: 'syntax', kind: 'contrast', foregrounds: SYNTAX, surfaces: ['bg', 'bg-active', 'line-highlight'], min: 4.5 },
{ id: 'ansi', kind: 'contrast', foregrounds: ANSI, surfaces: ['bg'], min: 4.5 },
+18 -8
View File
@@ -1,22 +1,32 @@
import type { BuiltinTheme } from './index.ts';
// Anthropic brand guidelines: https://github.com/anthropics/skills/blob/main/skills/brand-guidelines/SKILL.md
// Brand colors: Dark #141413, Light #faf9f5, Mid Gray #b0aea5, Light Gray #e8e6dc, Orange #d97757, Blue #6a9bcc, Green #788c5d.
// Text roles keep the brand hues with the lightness that gives 4.5:1. In light mode, the orange becomes #ab4e2f.
export const claude = {
id: 'claude' as const,
name: 'Claude',
fonts: { ui: '"Lora", Georgia, serif', prose: '"Lora", Georgia, serif', heading: '"Poppins", Arial, sans-serif' },
variants: {
// App: the layout of the Claude app, a #262624 page with darker #1f1e1d side panes.
dark: {
bg: '#141413', 'bg-elevated': '#20201e', 'bg-active': '#32322e', border: '#5a5952',
text: '#faf9f5', 'text-dim': '#b0aea5', 'text-strong': '#faf9f5',
accent: '#d97757', 'accent-2': '#6a9bcc', selection: '#674435',
error: '#f44747', 'warn-hot': '#d68a00', warn: '#cca700', ok: '#788c5d', special: '#6a9bcc',
bg: '#262624', 'bg-elevated': '#1f1e1d', 'bg-active': '#393937', border: '#4a4944',
text: '#ece9e1', 'text-dim': '#bbb9b0', 'text-strong': '#faf9f5',
accent: '#ed8968', 'accent-2': '#77a8da', selection: '#80503c',
error: '#fa5570', 'warn-hot': '#f2943c', warn: '#f1d35d', ok: '#9bc06a', special: '#77a8da',
'syntax-keyword': '#ed8968', 'syntax-string': '#a9cb7d', 'syntax-number': '#f5c076', 'syntax-comment': '#a7a49b',
'syntax-type': '#77a8da', 'syntax-function': '#fac092', 'syntax-property': '#9bc4e1', 'syntax-variable': '#ece9e1',
'syntax-constant': '#f5c076', 'syntax-punctuation': '#b0aea5', 'syntax-heading': '#ed8968',
},
// White: a white page with brand Light side panes (decision 9).
light: {
bg: '#faf9f5', 'bg-elevated': '#faf9f5', 'bg-active': '#e8e6dc', border: '#b0aea5',
text: '#141413', 'text-dim': '#67665f', 'text-strong': '#141413',
accent: '#d97757', 'accent-2': '#6a9bcc', selection: '#e8e6dc',
error: '#b42323', 'warn-hot': '#8a5700', warn: '#806600', ok: '#788c5d', special: '#6a9bcc',
bg: '#ffffff', 'bg-elevated': '#faf9f5', 'bg-active': '#efede6', border: '#dedbd1',
text: '#141413', 'text-dim': '#67665f', 'text-strong': '#000000',
accent: '#ab4e2f', 'accent-2': '#3d6d9b', selection: '#f5d3c5',
error: '#bf124e', 'warn-hot': '#b36300', warn: '#8b6e03', ok: '#2e7c35', special: '#3d6d9b',
'syntax-keyword': '#ab4e2f', 'syntax-string': '#5d7042', 'syntax-number': '#916000', 'syntax-comment': '#6b6a63',
'syntax-type': '#3d6d9b', 'syntax-function': '#984f92', 'syntax-property': '#3b6987', 'syntax-variable': '#141413',
'syntax-constant': '#916000', 'syntax-punctuation': '#67665f', 'syntax-heading': '#ab4e2f',
},
},
} satisfies BuiltinTheme;
+16 -8
View File
@@ -1,20 +1,28 @@
import type { BuiltinTheme } from './index.ts';
// Graphite (stage 5a-3): neutral gray surfaces, so the rune glow of the app icon is the only hue in the frame.
export const runestone = {
id: 'default' as const,
name: 'RuneStone',
variants: {
dark: {
bg: '#141414', 'bg-elevated': '#1c1c1c', 'bg-active': '#2a2a2a', border: '#2e2e2e',
text: '#e6e6e6', 'text-dim': '#9a9a9a', 'text-strong': '#f3f3f3',
accent: '#82aaff', selection: '#264f78',
error: '#f44747', 'warn-hot': '#d68a00', warn: '#cca700', ok: '#89d185', special: '#c792ea',
bg: '#151617', 'bg-elevated': '#1b1c1d', 'bg-active': '#2b2d2e', border: '#343637',
text: '#e4e4e4', 'text-dim': '#ababab', 'text-strong': '#f5f5f5',
accent: '#55dcf5', 'accent-2': '#92c1fd', selection: '#01596d',
error: '#ff525b', 'warn-hot': '#fe8c2c', warn: '#f6c919', ok: '#5cdc78', special: '#cb89fa',
'syntax-keyword': '#cb89fa', 'syntax-string': '#7eda82', 'syntax-number': '#ffa15c', 'syntax-comment': '#959595',
'syntax-type': '#eccb61', 'syntax-function': '#55dcf5', 'syntax-property': '#92c1fd', 'syntax-variable': '#e4e4e4',
'syntax-constant': '#ffa15c', 'syntax-punctuation': '#ababab', 'syntax-heading': '#55dcf5',
},
// Paper: the page is the lightest surface, and the side panes are a neutral gray (decision 9).
light: {
bg: '#f3f3f3', 'bg-elevated': '#ffffff', 'bg-active': '#e8e8e8', border: '#d4d4d4',
text: '#1e1e1e', 'text-dim': '#626262', 'text-strong': '#111111',
accent: '#315fb3', selection: '#add6ff',
error: '#b42323', 'warn-hot': '#8a5700', warn: '#806600', ok: '#287b29', special: '#7740a5',
bg: '#fdfdfa', 'bg-elevated': '#f3f2f0', 'bg-active': '#e5e4e2', border: '#d4d2cf',
text: '#242424', 'text-dim': '#636363', 'text-strong': '#141414',
accent: '#026f79', 'accent-2': '#3461ac', selection: '#a0e6ea',
error: '#c51d28', 'warn-hot': '#b95e00', warn: '#8b6800', ok: '#1b7e2a', special: '#8632b6',
'syntax-keyword': '#8632b6', 'syntax-string': '#1a7427', 'syntax-number': '#a44b00', 'syntax-comment': '#646464',
'syntax-type': '#805f00', 'syntax-function': '#026f79', 'syntax-property': '#3461ac', 'syntax-variable': '#242424',
'syntax-constant': '#a44b00', 'syntax-punctuation': '#636363', 'syntax-heading': '#026f79',
},
},
} satisfies BuiltinTheme;
+12 -7
View File
@@ -1,19 +1,24 @@
import { message } from '../../i18n/index.ts';
import type { BuiltinTheme } from './index.ts';
// Palette from pm-image:7968b79c-9d80-40a5-9e9a-696c26aacfb9.
// Palette from pm-image:7968b79c-9d80-40a5-9e9a-696c26aacfb9: Blossom White #fefcfc, Petal Veil #f8dbe6,
// Full Bloom #ffc9dc, Rose Garden #cb6b91, Plum Wine #98556c, Spring Leaf #dbeacb, Tea Leaf #618c71,
// Spring Rain #69a2bd, River Stone #607fa9, Morning Fog #687788.
// Petal (stage 5a-3): Petal Veil for active rows and a light Spring Leaf tint on the side panes.
// Text and syntax keep the reference hues with the lightness that gives 4.5:1.
export const sakura = {
id: 'sakura' as const,
name: 'Sakura',
notice: message('Sakura uses a light appearance.'),
variants: {
light: {
bg: '#fefcfc', 'bg-elevated': '#fefcfc', 'bg-active': '#dbeacb', border: '#f8dbe6',
text: '#513346', 'text-dim': '#687788', 'text-strong': '#321c2a',
accent: '#98556c', 'accent-2': '#607fa9', selection: '#ffc9dc', 'item-selection-bg': '#ffc9dca6',
error: '#b42323', 'warn-hot': '#8a5700', warn: '#806600', ok: '#618c71', special: '#cb6b91',
'syntax-keyword': '#98556c', 'syntax-variable': '#618c71',
'syntax-property': '#607fa9', 'syntax-constant': '#687788', 'syntax-punctuation': '#687788',
bg: '#fefcfc', 'bg-elevated': '#f5f9f0', 'bg-active': '#f8dbe6', border: '#efd3dd',
text: '#513346', 'text-dim': '#566575', 'text-strong': '#321c2a',
accent: '#a0446b', 'accent-2': '#47658e', selection: '#ffc9dc', 'item-selection-bg': '#ffc9dca6',
error: '#b93004', 'warn-hot': '#8a5700', warn: '#996600', ok: '#4f795f', special: '#98556c',
'syntax-keyword': '#a0446b', 'syntax-string': '#426c53', 'syntax-number': '#924f66', 'syntax-comment': '#566575',
'syntax-type': '#316a83', 'syntax-function': '#47658e', 'syntax-property': '#47658e', 'syntax-variable': '#513346',
'syntax-constant': '#316a83', 'syntax-punctuation': '#566575', 'syntax-heading': '#a0446b',
},
},
} satisfies BuiltinTheme;
+24 -19
View File
@@ -35,29 +35,34 @@
--rs-menu-icon-gap: 8px;
--rs-menu-font-size: 13px;
--rs-menu-border: transparent;
--rs-menu-bg: color-mix(in srgb, var(--rs-bg-elevated) var(--rs-surface-opacity), transparent);
--rs-menu-active-bg: color-mix(in srgb, var(--rs-bg-active) var(--rs-surface-opacity), transparent);
/* Menus are opaque. With a background image, they stay at least 92% opaque and blur the image (UI-043). */
--rs-menu-bg: var(--rs-bg-elevated);
--rs-menu-active-bg: var(--rs-bg-active);
--rs-menu-backdrop: none;
--rs-image-menu-bg: color-mix(in srgb, var(--rs-bg-elevated) max(92%, var(--rs-surface-opacity)), transparent);
--rs-image-menu-active-bg: color-mix(in srgb, var(--rs-bg-active) max(92%, var(--rs-surface-opacity)), transparent);
--rs-image-menu-backdrop: blur(18px) saturate(1.2);
--rs-menu-shadow: 0 8px 30px #0006;
--rs-item-selection-radius: var(--rs-control-radius);
--rs-item-selection-bg: color-mix(in srgb, var(--rs-accent) 20%, transparent);
--rs-item-selection-border: var(--rs-accent);
--rs-item-selection-width: 2px;
--rs-bg: #141414;
--rs-bg-elevated: #1c1c1c;
--rs-bg-active: #2a2a2a;
--rs-border: #2e2e2e;
--rs-text-dim: #9a9a9a;
--rs-text: #e6e6e6;
--rs-text-strong: #f3f3f3;
--rs-accent-2: #89ddff;
--rs-accent: #82aaff;
--rs-accent-dim: #6b8cce;
--rs-accent-deep: #4d6aa8;
--rs-error: #f44747;
--rs-warn-hot: #d68a00;
--rs-warn: #cca700;
--rs-ok: #89d185;
--rs-special: #c792ea;
--rs-bg: #151617;
--rs-bg-elevated: #1b1c1d;
--rs-bg-active: #2b2d2e;
--rs-border: #343637;
--rs-text-dim: #ababab;
--rs-text: #e4e4e4;
--rs-text-strong: #f5f5f5;
--rs-accent-2: #92c1fd;
--rs-accent: #55dcf5;
--rs-accent-dim: #48b4c9;
--rs-accent-deep: #3b8d9c;
--rs-error: #ff525b;
--rs-warn-hot: #fe8c2c;
--rs-warn: #f6c919;
--rs-ok: #5cdc78;
--rs-special: #cb89fa;
--rs-link: var(--rs-accent);
--rs-focus: var(--rs-accent);
--rs-on-accent: #000000;
@@ -84,7 +89,7 @@
--rs-h4-size: 1.15em;
--rs-h5-size: 1.08em;
--rs-h6-size: 1em;
--rs-selection: #264f78;
--rs-selection: #01596d;
--rs-line-highlight: #ffffff0d;
--rs-h1: var(--rs-text-strong);
--rs-h2: var(--rs-text-strong);
+6 -3
View File
@@ -17,7 +17,7 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
}
function hideSubmenu(parent: HTMLElement = root) {
const keep = parent === root ? 0 : opened.findIndex(entry => entry.panel === parent) + 1;
for (const { button, panel } of opened.splice(keep)) { panel.hidden = true; button.setAttribute("aria-expanded", "false"); }
for (const { button, panel } of opened.splice(keep)) { if (panel.matches(":popover-open")) panel.hidePopover(); button.setAttribute("aria-expanded", "false"); }
}
function positionSubmenu(button: HTMLButtonElement, panel: HTMLElement) {
const rect = button.getBoundingClientRect(), size = panel.getBoundingClientRect(), main = button.parentElement!.getBoundingClientRect();
@@ -26,7 +26,8 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
}
function reveal(button: HTMLButtonElement, panel: HTMLElement, focus = false) {
if (!opened.some(entry => entry.panel === panel)) { hideSubmenu(button.parentElement!); opened.push({ button, panel }); }
panel.hidden = false; button.setAttribute("aria-expanded", "true");
if (!panel.matches(":popover-open")) panel.showPopover();
button.setAttribute("aria-expanded", "true");
positionSubmenu(button, panel);
if (focus) focusRow(panel.querySelector<HTMLButtonElement>("button:not(:disabled)") ?? undefined);
}
@@ -46,7 +47,9 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
if (item.children) {
button.setAttribute("aria-haspopup", "menu"); button.setAttribute("aria-expanded", "false");
const arrow = actionIcon("chevron"); arrow.classList.add("action-chevron"); button.append(arrow);
const submenu = document.createElement("div"); submenu.className = "rs-menu table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label); submenu.hidden = true;
const submenu = document.createElement("div"); submenu.className = "rs-menu table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label);
// A popover shows in the top layer, so the blur of the parent menu cannot clip or move it.
submenu.popover = "manual";
populate(submenu, item.children); root.append(submenu); submenus.set(button, submenu);
button.addEventListener("mousemove", () => { if (!button.disabled) reveal(button, submenu); });
button.addEventListener("click", event => {
+2 -1
View File
@@ -8,6 +8,7 @@
border: 1px solid var(--rs-menu-border);
border-radius: var(--rs-control-radius);
background: var(--rs-menu-bg);
backdrop-filter: var(--rs-menu-backdrop);
color: var(--rs-text);
box-shadow: var(--rs-menu-shadow);
font: var(--rs-menu-font-size)/1.4 var(--rs-font-ui);
@@ -16,7 +17,7 @@
.rs-menu { position: fixed; }
.rs-picker { box-sizing: border-box; }
.rs-menu.table-cell-submenu { z-index: 1001; }
.rs-menu.table-cell-submenu { z-index: 1001; inset: auto; margin: 0; }
.rs-menu > button, .rs-picker .rs-picker-row {
display: flex;