diff --git a/docs/design-decisions.md b/docs/design-decisions.md index 97be5a8..1e21748 100644 --- a/docs/design-decisions.md +++ b/docs/design-decisions.md @@ -302,7 +302,7 @@ Keyboard focus now scrolls only the menu panel. It cannot dismiss a menu by scro - Type: Rule change - Date: 2026-10-12 -- Status: Implemented for user review +- Status: Superseded by [UI-043](#ui-043--opaque-menus) - Decision source: Card e3c5261f requests transparency across menus. - Previous rule: Menus used opaque elevated surfaces. - New rule: Shared menus use an 82% theme tint, including hover and active rows. @@ -314,6 +314,7 @@ Keyboard focus now scrolls only the menu panel. It cannot dismiss a menu by scro - Screenshots: `.audit/menu-file-light.png`, `.audit/menu-file-dark.png`, and `.audit/menu-edge.png`. - Limits: Native desktop appearance requires user review. - Replaces: The opaque menu exception in UI-011. +- Replaced by: [UI-043](#ui-043--opaque-menus) makes menus opaque without a background image. ### UI-014 — Readable Project Management surfaces @@ -810,3 +811,41 @@ Native shell, background image, and desktop acceptance remain open. - Evidence: The applied colors and the Source colors of each tag group are the same as before stage 5a-1, for every built-in theme and a saved schema 2 custom theme. `tests/unit/theme/customThemes.spec.ts` covers schema 3, `base`, and the conversion of old syntax names. - Replaces / replaced by: The template format of [UI-028](#ui-028--adjustable-surface-transparency-and-fixed-custom-palettes). Its transparency rule remains. - Limits: Browser checks use desktop service mocks. Native desktop acceptance remains open. + +### UI-043 — Opaque menus + +- Type: Rule change +- Date: 2026-10-28 +- Status: Implemented for user review +- Decision source: Owner decision 1 of 2026-10-27 (interface review issue 1), in stage 5a-3 of the approved Phase 5a plan. +- Previous rule: [UI-013](#ui-013--translucent-menu-surfaces). Menus used an 82% theme tint without blur, so document text showed through menu rows. +- New rule: Menus are opaque. `--rs-menu-bg` is `--rs-bg-elevated`, and `--rs-menu-active-bg` is `--rs-bg-active`. Only with a background image, menus are at least 92% opaque and blur the image. A lower transparency amount makes them more opaque. +- Submenus: Submenus show as manual popovers in the top layer. A blur makes the parent menu the containing block of its fixed children, so the blur clipped and moved submenus inside it. +- Reason: Menu labels must not collide with document text. Without an image, nothing behind a menu needs to show. +- Scope: Host action menus, submenus, plugin menus through the host API, and the workspace picker. +- Shared implementation: `tokens.css` (`--rs-menu-bg`, `--rs-menu-active-bg`, `--rs-menu-backdrop`, and the `--rs-image-menu-*` tokens), `menu.css`, `appearance.ts` and `backgrounds.ts` (the image switch), and `actionMenu.ts` (popover submenus). +- Evidence: `tests/smoke/menus/consistency.smoke.mjs` checks an opaque menu without an image, and 92% with a blur over an image. Screenshots are in `output/phase-5a/5a-3/` in the main checkout. +- Replaces: [UI-013](#ui-013--translucent-menu-surfaces). +- Limits: Browser checks use desktop service mocks. Native desktop acceptance remains open. + +### UI-044 — Core palettes and the lightest page + +- Type: Rule change +- Date: 2026-10-28 +- Status: Implemented for user review +- Decision source: Owner decision 9 and the theme-colors group of decision 13 (interface review issues 6 and 20). The owner chose candidate B of each palette on 2026-10-28. +- Previous rule: In RuneStone Light, the page was darker than the side panes. In Claude Light, the page and the panes had one color. Each core palette failed 2 to 8 readability rules, for example Claude Light links at 2.96:1. +- New rule: In a light palette, the page (`bg`) is the lightest surface, and the side panes (`bg-elevated`) have a slight tint. Every core palette passes all readability rules in `contrast.ts`. A text role keeps the hue of its source and changes only its lightness to reach 4.5:1. +- RuneStone Dark (Graphite): neutral graphite surfaces. The rune cyan of the app icon, `#55dcf5`, is the only hue in the frame. +- RuneStone Light (Paper): a warm paper page `#fdfdfa`, neutral gray panes, and a teal accent `#026f79`. +- Claude Dark (App): the layout of the Claude app, a `#262624` page with darker `#1f1e1d` panes, and the orange `#ed8968`. +- Claude Light (White): a white page, brand Light `#faf9f5` panes, and the orange `#ab4e2f` for text. The brand orange `#d97757` has only 2.5:1 on the light grays. +- Sakura (Petal): a Blossom White page, Petal Veil for active rows, a light Spring Leaf tint on the panes, and the Rose Garden hue `#a0446b` as accent. +- Rule addition: The `accent-text` rule also checks `accent-2`, because inline code in Read uses it as text. +- Reason: Readable text, links, status colors, and syntax in every core palette. The page draws the eye, not the frame. +- Scope: RuneStone, Claude, and Sakura. Stage 5a-4 redesigns the character palettes. +- Shared implementation: `themes/runestone.ts`, `themes/claude.ts`, `themes/sakura.ts`, `contrast.ts`, and the root defaults in `tokens.css`. +- Visible changes: The colors of the five palettes. +- Evidence: The comparison sheets and `readability.md` in `output/phase-5a/5a-3/` in the main checkout. `tests/unit/theme/contrast.spec.ts` lists no failures for these palettes. +- Replaces / replaced by: None. +- Limits: Browser checks use desktop service mocks. Native desktop acceptance remains open. diff --git a/docs/menu-surfaces.json b/docs/menu-surfaces.json index 4f458aa..3b4c38a 100644 --- a/docs/menu-surfaces.json +++ b/docs/menu-surfaces.json @@ -156,9 +156,9 @@ "RuneStone/src/lib/ui/actionMenu.ts": { "counts": { "action": 1, - "localPopup": 2 + "localPopup": 3 }, - "design": "Shared action menu", + "design": "Shared action menu. Submenus are manual popovers in the top layer (UI-043).", "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/ui/managedActionMenu.ts": { diff --git a/docs/ui-color.md b/docs/ui-color.md index dab54f0..b746045 100644 --- a/docs/ui-color.md +++ b/docs/ui-color.md @@ -44,6 +44,8 @@ Plugins use the same tokens. [Theme tokens](plugin-development.md#theme-tokens) ## Theme references - Read the current reference cards, and obey the source priority that the user gives. +- RuneStone takes its accent from the rune glow of the app icon (`src-tauri/icons/icon.png`). Claude takes its colors from the Anthropic brand guide. Sakura takes its colors from the palette image in its data file. +- A text role keeps the hue of its reference color. Change only its lightness until it reaches the readability minimum, and call the result an adaptation. - Harvest Moon (Holo) uses the current fan art. Removed images do not count for later palette decisions. - Take the colors of the character. Exclude scenery, lighting, alternate clothing, and unrelated details. - The trading screenshot and the Bloomberg example show clear information and state distinctions. They do not ask for a terminal-like appearance. @@ -69,7 +71,7 @@ Each surface is the color that the app draws: a translucent role is composited o | Rule | Check | Minimum | | --- | --- | --- | | `text` | `text`, `text-dim`, and `text-strong` on `bg`, `bg-elevated`, `bg-active`, and `selection` | 4.5:1 | -| `accent-text` | `accent` and `link` on `bg`, `bg-elevated`, and `bg-active` | 4.5:1 | +| `accent-text` | `accent`, `accent-2`, and `link` on `bg`, `bg-elevated`, and `bg-active` | 4.5:1 | | `status-text` | `error`, `warn`, and `ok` on `bg` and `bg-elevated` | 4.5:1 | | `syntax` | Each syntax role on `bg`, `bg-active`, and `line-highlight` | 4.5:1 | | `ansi` | Red, green, yellow, blue, magenta, and cyan terminal colors, and their bright variants, on `bg` | 4.5:1 | diff --git a/docs/ui-design.md b/docs/ui-design.md index b2c4004..e255b3d 100644 --- a/docs/ui-design.md +++ b/docs/ui-design.md @@ -52,7 +52,8 @@ Do not copy feature-specific colors into a shared control. | `--rs-menu-font-size` | 13px | Menu text | | `--rs-menu-icon-size` / `--rs-menu-icon-gap` | 14px / 8px | Menu icon and its gap to the label | | `--rs-menu-border` | `transparent` | Borderless panel. `--rs-menu-shadow` supplies the edge. | -| `--rs-menu-bg`, `--rs-menu-active-bg` | `--rs-surface-opacity` tint | Menu surface and hover or focus fill | +| `--rs-menu-bg`, `--rs-menu-active-bg` | `--rs-bg-elevated`, `--rs-bg-active` | Opaque menu surface and hover or focus fill. With a background image: at least 92% opaque. | +| `--rs-menu-backdrop` | `none` | With a background image: `blur(18px) saturate(1.2)` | | `--rs-surface-opacity` | 82% | Shared surface tint. Appearance settings adjust it. | ## Icons and labels @@ -94,7 +95,8 @@ Use one menu design for context menus, action menus, and their submenus in the h - Use the `--rs-menu-*` tokens and `--rs-control-radius`. One menu family shares font, row height, padding, icon size, label alignment, separators, and shadow. - A menu can grow wider when its content needs more space. All other measurements stay shared. - Keep the padding inset around every row, so hover and focus fills do not touch the panel edge. -- The panel is borderless, with a shadow. Its surface uses the `--rs-surface-opacity` tint through `--rs-menu-bg` and `--rs-menu-active-bg`. Text and icons stay opaque. Host menus, plugin menus, submenus, and the workspace picker all use this surface. +- The panel is borderless, with a shadow. Its surface is opaque through `--rs-menu-bg` and `--rs-menu-active-bg`. Only with a background image, it is at least 92% opaque and blurs the image. Host menus, plugin menus, submenus, and the workspace picker all use this surface. +- Submenus show as popovers in the top layer, so the blur of the parent menu cannot clip them. - Plugins call `api.ui.showActionMenu` for the host menu, when the host API exists. The host handles dismissal, focus return, and plugin cleanup. ### Rows and columns @@ -131,7 +133,7 @@ Use one menu design for context menus, action menus, and their submenus in the h - Native editing menus keep recognized editing, spelling, and emoji commands. The host removes system sharing, writing direction, dictation, and unnamed tools before shared display or native fallback. - New note creates a blank note. Its submenu contains templates and Manage templates. -Decisions: [UI-002](design-decisions.md#ui-002--share-the-requested-dropdown-design), [UI-003](design-decisions.md#ui-003--quiet-menu-choices), [UI-006](design-decisions.md#ui-006--borderless-shared-menus), [UI-007](design-decisions.md#ui-007--repeated-menu-drift), [UI-008](design-decisions.md#ui-008--keep-native-editing-menus-focused), [UI-013](design-decisions.md#ui-013--translucent-menu-surfaces), [UI-026](design-decisions.md#ui-026--compact-shared-menu-rows), [UI-027](design-decisions.md#ui-027--direct-spelling-corrections). +Decisions: [UI-002](design-decisions.md#ui-002--share-the-requested-dropdown-design), [UI-003](design-decisions.md#ui-003--quiet-menu-choices), [UI-006](design-decisions.md#ui-006--borderless-shared-menus), [UI-007](design-decisions.md#ui-007--repeated-menu-drift), [UI-008](design-decisions.md#ui-008--keep-native-editing-menus-focused), [UI-026](design-decisions.md#ui-026--compact-shared-menu-rows), [UI-027](design-decisions.md#ui-027--direct-spelling-corrections), [UI-043](design-decisions.md#ui-043--opaque-menus). ## Window and navigation @@ -174,7 +176,9 @@ Decisions: [UI-005](design-decisions.md#ui-005--heading-spacing). ### Palettes - Color choices obey [Functional color](ui-color.md). -- The Claude palette follows the [Anthropic brand guide](https://github.com/anthropics/skills/blob/main/skills/brand-guidelines/SKILL.md): warm light and dark surfaces, an orange accent, Lora body text, and Poppins headings, with their fallbacks. +- In a light palette, the page is the lightest surface. The side panes have a slight tint. +- RuneStone uses neutral surfaces. The rune cyan of the app icon is its accent. +- The Claude palette follows the [Anthropic brand guide](https://github.com/anthropics/skills/blob/main/skills/brand-guidelines/SKILL.md): warm light and dark surfaces, an orange accent, Lora body text, and Poppins headings, with their fallbacks. In light mode, text uses a darker orange, because the brand orange is not readable on the light grays. - Named palettes have one fixed appearance. Each local font stack has fallbacks. Code keeps the shared monospace stack. | Palette | Appearance | Controls | Prose | Headings | @@ -186,7 +190,7 @@ Decisions: [UI-005](design-decisions.md#ui-005--heading-spacing). - A saved choice for a removed palette returns to RuneStone and keeps its mode and background settings. A renamed palette keeps its colors and backgrounds. - The theme preview includes code colors. -Decisions: [UI-009](design-decisions.md#ui-009--character-theme-appearances), [UI-012](design-decisions.md#ui-012--retain-three-stronger-character-themes), [UI-018](design-decisions.md#ui-018--named-palettes-and-local-fonts), [UI-023](design-decisions.md#ui-023--separate-theme-font-roles), [UI-024](design-decisions.md#ui-024--assertive-functional-color-by-default). +Decisions: [UI-009](design-decisions.md#ui-009--character-theme-appearances), [UI-012](design-decisions.md#ui-012--retain-three-stronger-character-themes), [UI-018](design-decisions.md#ui-018--named-palettes-and-local-fonts), [UI-023](design-decisions.md#ui-023--separate-theme-font-roles), [UI-024](design-decisions.md#ui-024--assertive-functional-color-by-default), [UI-044](design-decisions.md#ui-044--core-palettes-and-the-lightest-page). ### Surfaces over images diff --git a/src/lib/plugins/backgrounds.ts b/src/lib/plugins/backgrounds.ts index 0b6ad53..04ad295 100644 --- a/src/lib/plugins/backgrounds.ts +++ b/src/lib/plugins/backgrounds.ts @@ -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); diff --git a/src/lib/theme/appearance.ts b/src/lib/theme/appearance.ts index 81a934b..e953f67 100644 --- a/src/lib/theme/appearance.ts +++ b/src/lib/theme/appearance.ts @@ -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; diff --git a/src/lib/theme/contrast.ts b/src/lib/theme/contrast.ts index 5150f2c..504dd45 100644 --- a/src/lib/theme/contrast.ts +++ b/src/lib/theme/contrast.ts @@ -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 }, diff --git a/src/lib/theme/themes/claude.ts b/src/lib/theme/themes/claude.ts index a89480b..4ab4d8a 100644 --- a/src/lib/theme/themes/claude.ts +++ b/src/lib/theme/themes/claude.ts @@ -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; diff --git a/src/lib/theme/themes/runestone.ts b/src/lib/theme/themes/runestone.ts index 485467d..6a6f17d 100644 --- a/src/lib/theme/themes/runestone.ts +++ b/src/lib/theme/themes/runestone.ts @@ -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; diff --git a/src/lib/theme/themes/sakura.ts b/src/lib/theme/themes/sakura.ts index ac36c5b..a1224ac 100644 --- a/src/lib/theme/themes/sakura.ts +++ b/src/lib/theme/themes/sakura.ts @@ -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; diff --git a/src/lib/theme/tokens.css b/src/lib/theme/tokens.css index 3ae9064..5e64970 100644 --- a/src/lib/theme/tokens.css +++ b/src/lib/theme/tokens.css @@ -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); diff --git a/src/lib/ui/actionMenu.ts b/src/lib/ui/actionMenu.ts index fd63577..0dfb65b 100644 --- a/src/lib/ui/actionMenu.ts +++ b/src/lib/ui/actionMenu.ts @@ -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("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 => { diff --git a/src/lib/ui/menu.css b/src/lib/ui/menu.css index 70f01d0..07eb831 100644 --- a/src/lib/ui/menu.css +++ b/src/lib/ui/menu.css @@ -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; diff --git a/tests/smoke/appearance/palettes.smoke.mjs b/tests/smoke/appearance/palettes.smoke.mjs index c5e53de..9e8d506 100644 --- a/tests/smoke/appearance/palettes.smoke.mjs +++ b/tests/smoke/appearance/palettes.smoke.mjs @@ -104,7 +104,7 @@ await runSmoke("appearance/palettes", async ({ browser }) => { const keyword = spans.find(span => !span.children.length && span.textContent.trim() === "def"); return keyword ? getComputedStyle(keyword).color : null; }); - assert.equal(keywordColor, "rgb(152, 85, 108)", "Sakura keywords use Plum Wine"); + assert.equal(keywordColor, "rgb(160, 68, 107)", "Sakura keywords use the Rose Garden hue"); } const typography = await settings.evaluate(() => ({ body: getComputedStyle(document.body).fontFamily, @@ -115,7 +115,7 @@ await runSmoke("appearance/palettes", async ({ browser }) => { assert.match(typography.body, /Lora.*Georgia/); assert.match(typography.prose, /Lora.*Georgia/); assert.match(typography.heading, /Poppins.*Arial/); - assert.equal(await settings.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--rs-accent").trim()), "#d97757"); + assert.equal(await settings.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--rs-accent").trim()), mode === "light" ? "#ab4e2f" : "#ed8968"); } else assert.doesNotMatch(typography.body, /Lora|Georgia/); console.log(`PASS: ${theme} ${mode}, saved state, cross-window selection, existing and new source editors`); } @@ -131,7 +131,7 @@ await runSmoke("appearance/palettes", async ({ browser }) => { return Object.fromEntries(["bg", "border", "selection", "bg-active", "syntax-keyword", "syntax-variable", "syntax-property", "syntax-constant", "syntax-punctuation"].map(key => [key, css.getPropertyValue(`--rs-${key}`).trim()])); }); // The applied selection color caps its alpha at a6 so text backgrounds show through (appliedColors in src/lib/theme/contrast.ts). - assert.deepEqual(sakura, { bg: "#fefcfc", border: "#f8dbe6", selection: "#ffc9dca6", "bg-active": "#dbeacb", "syntax-keyword": "#98556c", "syntax-variable": "#618c71", "syntax-property": "#607fa9", "syntax-constant": "#687788", "syntax-punctuation": "#687788" }); + assert.deepEqual(sakura, { bg: "#fefcfc", border: "#efd3dd", selection: "#ffc9dca6", "bg-active": "#f8dbe6", "syntax-keyword": "#a0446b", "syntax-variable": "#513346", "syntax-property": "#47658e", "syntax-constant": "#316a83", "syntax-punctuation": "#566575" }); for (const [theme, savedMode, expectedTheme, mode] of [ ["gpt", "light", "default", "light"], ["terminal", "dark", "default", "dark"], diff --git a/tests/smoke/browser/webData.smoke.mjs b/tests/smoke/browser/webData.smoke.mjs index 9087622..3315533 100644 --- a/tests/smoke/browser/webData.smoke.mjs +++ b/tests/smoke/browser/webData.smoke.mjs @@ -175,7 +175,7 @@ await runSmoke('browser/webData', async ({ page }) => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); saveAppearance({ theme: 'default', mode }); }, theme); - assert.equal(await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--rs-bg').trim()), theme === 'light' ? '#f3f3f3' : '#141414'); + assert.equal(await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--rs-bg').trim()), theme === 'light' ? '#fdfdfa' : '#151617'); for (const dataType of ['cookies', 'history']) { await selectKind(dataType); await section.scrollIntoViewIfNeeded(); diff --git a/tests/smoke/layout/workbench.smoke.mjs b/tests/smoke/layout/workbench.smoke.mjs index 799e34a..0c800ed 100644 --- a/tests/smoke/layout/workbench.smoke.mjs +++ b/tests/smoke/layout/workbench.smoke.mjs @@ -682,7 +682,7 @@ await runSmoke("layout/workbench", async ({ page }) => { await page.setViewportSize({ width: 800, height: 600 }); await actionCell(1, 0).click({ button: 'right' }); await page.getByRole('menuitem', { name: 'Column', exact: true }).hover(); - assert.ok(await page.locator('.table-cell-menu, .table-cell-submenu:not([hidden])').evaluateAll(panels => panels.every(panel => { + assert.ok(await page.locator('.table-cell-menu, .table-cell-submenu:popover-open').evaluateAll(panels => panels.every(panel => { const rect = panel.getBoundingClientRect(); return rect.left >= 0 && rect.top >= 0 && rect.right <= innerWidth && rect.bottom <= innerHeight; }))); await page.keyboard.press('Escape'); diff --git a/tests/smoke/menus/consistency.smoke.mjs b/tests/smoke/menus/consistency.smoke.mjs index ccd3827..75419b7 100644 --- a/tests/smoke/menus/consistency.smoke.mjs +++ b/tests/smoke/menus/consistency.smoke.mjs @@ -36,7 +36,7 @@ await runSmoke("menus/consistency", async ({ page }) => { const label = row.querySelector(".action-label"); const css = getComputedStyle(node), button = getComputedStyle(row); return { - panel: [css.padding, css.borderRadius, css.backgroundColor, css.color, css.boxShadow, css.font], + panel: [css.padding, css.borderRadius, css.backgroundColor, css.color, css.boxShadow, css.font, css.backdropFilter], row: [button.padding, button.minHeight, button.borderRadius, button.gap, button.font], iconWidth: icon.getBoundingClientRect().width, inset: Math.round(row.getBoundingClientRect().left - node.getBoundingClientRect().left), @@ -52,6 +52,12 @@ await runSmoke("menus/consistency", async ({ page }) => { const tab = page.getByRole("tab", { name: "a.md", exact: true }); await tab.waitFor(); await page.locator(".cm-content").waitFor(); + // Without a background image, menus are opaque and do not blur (UI-043). + await row.click({ button: "right" }); + const opaque = await metrics(menu("File actions")); + assert.match(opaque.panel[2], /^rgb\(/, "Menus are opaque without a background image"); + assert.equal(opaque.panel[6], "none"); + await dismiss(); for (const theme of ["dark", "light"]) { await page.evaluate(async mode => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); @@ -84,7 +90,8 @@ await runSmoke("menus/consistency", async ({ page }) => { assert.ok(compactHeight < previousHeight * .85, 'The same actions use at least 15% less vertical space'); console.log(JSON.stringify({ theme, compactHeight, previousHeight })); await page.screenshot({ path: path.join(output, `menu-spacing-after-${theme}.png`) }); - assert.ok(reference.panel[2].includes('/ 0.82') || /rgba\(.+, 0\.82\)/.test(reference.panel[2]), "Shared menus retain an 82% surface tint"); + assert.ok(reference.panel[2].includes('/ 0.92') || /rgba\(.+, 0\.92\)/.test(reference.panel[2]), "With a background image, menus are at least 92% opaque"); + assert.match(reference.panel[6], /blur\(18px\)/, "With a background image, menus blur it"); assert.ok(reference.inset >= 5, "Rows need an inset from the panel border"); assert.equal(await item("Pin").locator("svg.action-icon").count(), 1); const offsets = await file.locator(":scope > button").evaluateAll(nodes => nodes.map(node => Math.round(node.querySelector(".action-label").getBoundingClientRect().left - node.getBoundingClientRect().left))); diff --git a/tests/unit/theme/contrast.spec.ts b/tests/unit/theme/contrast.spec.ts index defe82b..b3a428c 100644 --- a/tests/unit/theme/contrast.spec.ts +++ b/tests/unit/theme/contrast.spec.ts @@ -9,13 +9,8 @@ import { BASE_ROLES, resolveColors, type Mode } from '../../../src/lib/theme/rol import { RULES, checkTheme } from '../../../src/lib/theme/contrast.ts'; import { composite, contrast, distance, formatHex, mix, parseHex } from '../../../src/lib/theme/color.ts'; -// Rules that a palette fails today. Stages 5a-3 and 5a-4 redesign these palettes and remove each entry. +// Rules that a palette fails today. Stage 5a-4 redesigns these palettes and removes each entry. const KNOWN_FAILURES: Record = { - 'default/dark': ['text', 'syntax-variety'], - 'default/light': ['text', 'syntax', 'syntax-variety', 'light-page'], - 'claude/dark': ['accent-text', 'status-text', 'syntax', 'status-distinct', 'syntax-variety'], - 'claude/light': ['accent-text', 'status-text', 'syntax', 'ansi', 'focus', 'selection-outline', 'syntax-variety', 'light-page'], - 'sakura/light': ['text', 'accent-text', 'status-text', 'syntax', 'ansi', 'syntax-variety', 'light-page'], 'harvest-moon/dark': ['status-text', 'status-distinct'], 'crimson-pilot/dark': ['status-distinct'], 'silver-serpent/dark': ['status-text', 'status-distinct'], @@ -30,7 +25,7 @@ for (const variant of variants) { if (!results.length) continue; const known = KNOWN_FAILURES[variant.key]?.includes(rule.id); const failures = results.filter(finding => !finding.pass).map(finding => `${finding.subject}: ${finding.value.toFixed(2)} (minimum ${finding.min})`); - test(`${variant.key} passes the ${rule.id} rule`, known ? { todo: 'Known palette failure. Stages 5a-3 and 5a-4 redesign this palette.' } : {}, () => { + test(`${variant.key} passes the ${rule.id} rule`, known ? { todo: 'Known palette failure. Stage 5a-4 redesigns this palette.' } : {}, () => { assert.deepEqual(failures, []); }); if (known) test(`${variant.key} still fails the known ${rule.id} rule`, () => {