H5: banner-aligned themes, diagnostic and VCS tokens
Both themes follow the README banner without taking it over: calm, near-neutral surfaces (cream-tinted light, faintly plum-tinted dark), the raspberry only as the accent, retuned syntax colours and the terminal on the editor surface. Approved by the owner from before/after screenshots. New tokens `--lt-diag-error|warning|info|hint` (lint underlines, gutter, tooltips, Problems icons) and `--lt-vcs-added|modified|deleted|untracked| ignored|conflicted` (for M4.4), listed in `theme::DIAGNOSTIC_TOKENS` and `theme::VCS_TOKENS`. Completion kind icons take the syntax colour of their kind. The contrast test checks every new colour (4.5:1 text, 3:1 icons) in both themes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e73bdbbbbc
commit
9801a346b6
13 changed files with 345 additions and 175 deletions
|
|
@ -281,7 +281,7 @@ mod tests {
|
|||
fn reads_theme_colours() {
|
||||
assert_eq!(
|
||||
token_color(&theme::DARK, "bg"),
|
||||
Some(Color(0x1f, 0x1d, 0x1b, 255))
|
||||
Some(Color(0x1e, 0x1b, 0x1e, 255))
|
||||
);
|
||||
assert_eq!(token_color(&theme::DARK, "missing"), None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,5 +130,5 @@ fn switching_streams_theme_changed_with_tokens() {
|
|||
changed["id"], "lutra-light",
|
||||
"switching from dark to system on an unreported (dark) OS must not emit"
|
||||
);
|
||||
assert_eq!(changed["tokens"]["--lt-editor-selection-bg"], "#e5d7c9");
|
||||
assert_eq!(changed["tokens"]["--lt-editor-selection-bg"], "#ecd6dc");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
//!
|
||||
//! Themes are defined here in Rust and rendered as CSS custom properties
|
||||
//! (`--lt-<token>`). Frontend components use only `var(--lt-…)`. The palettes
|
||||
//! are Lutra's own: warm otter browns with a copper accent. Text and
|
||||
//! background pairs meet WCAG AA in both themes; `ui/tests/theme` checks it
|
||||
//! against the snapshot `ui/tests/theme/themes.json`, which the test
|
||||
//! are Lutra's own and follow the README banner: calm, near-neutral surfaces
|
||||
//! (cream-tinted in the light theme, faintly plum-tinted in the dark one)
|
||||
//! with the banner's raspberry as the only accent. Text and background pairs
|
||||
//! meet WCAG AA in both themes; `ui/tests/theme` checks it against the snapshot `ui/tests/theme/themes.json`, which the test
|
||||
//! `ui_snapshot_is_current` keeps in step with this file.
|
||||
//!
|
||||
//! The setting `appearance.theme` holds a theme id or [`SYSTEM`]. "System"
|
||||
|
|
@ -47,7 +48,8 @@ const COMMON: &[(&str, &str)] = &[
|
|||
/// Syntax token names (`--lt-syntax-<name>`) every theme defines. The
|
||||
/// editor's highlighter reads only these; each reaches 4.5:1 on the editor
|
||||
/// background (`ui/tests/theme/contrast.test.ts`). The colours are Lutra's
|
||||
/// own, derived from the theme's copper accent and warm neutrals.
|
||||
/// own, tuned to sit next to the raspberry accent without repeating it
|
||||
/// (only keywords take a muted raspberry).
|
||||
pub const SYNTAX_TOKENS: &[&str] = &[
|
||||
"keyword",
|
||||
"string",
|
||||
|
|
@ -91,61 +93,91 @@ pub const TERMINAL_TOKENS: &[&str] = &[
|
|||
"ansi-bright-white",
|
||||
];
|
||||
|
||||
/// Diagnostic severity token names (`--lt-diag-<name>`) every theme
|
||||
/// defines. They colour the editor's lint underlines, gutter markers and
|
||||
/// tooltip stripes and the Problems window's severity icons; each reaches
|
||||
/// 4.5:1 on the editor background, the active line and the window
|
||||
/// background (`ui/tests/theme/contrast.test.ts`).
|
||||
pub const DIAGNOSTIC_TOKENS: &[&str] = &["error", "warning", "info", "hint"];
|
||||
|
||||
/// Version-control status token names (`--lt-vcs-<name>`) every theme
|
||||
/// defines, for file names in the project tree and tabs and for the
|
||||
/// editor's change markers. Each reaches 4.5:1 as text on the editor
|
||||
/// background, the active line and the window background.
|
||||
pub const VCS_TOKENS: &[&str] = &[
|
||||
"added",
|
||||
"modified",
|
||||
"deleted",
|
||||
"untracked",
|
||||
"ignored",
|
||||
"conflicted",
|
||||
];
|
||||
|
||||
/// The default dark theme.
|
||||
pub const DARK: Theme = Theme {
|
||||
id: "lutra-dark",
|
||||
label_key: "theme.lutraDark",
|
||||
dark: true,
|
||||
tokens: &[
|
||||
("bg", "#1f1d1b"),
|
||||
("editor-bg", "#191817"),
|
||||
("fg", "#e6e1da"),
|
||||
("fg-muted", "#9a928a"),
|
||||
("border", "#34302c"),
|
||||
("accent", "#d39a5c"),
|
||||
("error", "#ef7b6c"),
|
||||
("statusbar-bg", "#24211f"),
|
||||
("statusbar-fg", "#b8afa6"),
|
||||
("editor-selection-bg", "#513f2c"),
|
||||
("editor-active-line-bg", "#232221"),
|
||||
("editor-cursor", "#d39a5c"),
|
||||
("editor-gutter-bg", "#191817"),
|
||||
("editor-gutter-fg", "#9a928a"),
|
||||
("editor-match-bg", "#3a2f23"),
|
||||
("tab-active-bg", "#191817"),
|
||||
("tab-modified", "#d39a5c"),
|
||||
("notice-bg", "#3a3025"),
|
||||
("syntax-keyword", "#d39a5c"),
|
||||
("bg", "#1e1b1e"),
|
||||
("editor-bg", "#181618"),
|
||||
("fg", "#ebe5dc"),
|
||||
("fg-muted", "#9e9499"),
|
||||
("border", "#362f35"),
|
||||
("accent", "#e27ba6"),
|
||||
("error", "#f2836b"),
|
||||
("statusbar-bg", "#231f23"),
|
||||
("statusbar-fg", "#bdb3b8"),
|
||||
("editor-selection-bg", "#4c2d3d"),
|
||||
("editor-active-line-bg", "#221f22"),
|
||||
("editor-cursor", "#e27ba6"),
|
||||
("editor-gutter-bg", "#181618"),
|
||||
("editor-gutter-fg", "#9e9499"),
|
||||
("editor-match-bg", "#3a2632"),
|
||||
("tab-active-bg", "#181618"),
|
||||
("tab-modified", "#e27ba6"),
|
||||
("notice-bg", "#382632"),
|
||||
("syntax-keyword", "#d98aab"),
|
||||
("syntax-string", "#a9bd7e"),
|
||||
("syntax-number", "#e3a1a8"),
|
||||
("syntax-comment", "#958d84"),
|
||||
("syntax-variable", "#d8bba6"),
|
||||
("syntax-number", "#e8a87c"),
|
||||
("syntax-comment", "#978e93"),
|
||||
("syntax-variable", "#dcc6b2"),
|
||||
("syntax-function", "#e6c46f"),
|
||||
("syntax-type", "#7fbac6"),
|
||||
("syntax-constant", "#c4a0d6"),
|
||||
("syntax-constant", "#b9a5e2"),
|
||||
("syntax-tag", "#e08b70"),
|
||||
("syntax-attribute", "#cdb87e"),
|
||||
("syntax-operator", "#b8afa6"),
|
||||
("terminal-bg", "#191817"),
|
||||
("terminal-fg", "#e6e1da"),
|
||||
("terminal-cursor", "#d39a5c"),
|
||||
("terminal-selection-bg", "#513f2c"),
|
||||
("terminal-ansi-black", "#2e2b28"),
|
||||
("syntax-operator", "#bdb3b8"),
|
||||
("diag-error", "#f2836b"),
|
||||
("diag-warning", "#e6b450"),
|
||||
("diag-info", "#8fb0e8"),
|
||||
("diag-hint", "#9e9499"),
|
||||
("vcs-added", "#9cc27a"),
|
||||
("vcs-modified", "#8fb0e8"),
|
||||
("vcs-deleted", "#d4908a"),
|
||||
("vcs-untracked", "#e3a464"),
|
||||
("vcs-ignored", "#8f878b"),
|
||||
("vcs-conflicted", "#f26d82"),
|
||||
("terminal-bg", "#181618"),
|
||||
("terminal-fg", "#ebe5dc"),
|
||||
("terminal-cursor", "#e27ba6"),
|
||||
("terminal-selection-bg", "#4c2d3d"),
|
||||
("terminal-ansi-black", "#2e2a2e"),
|
||||
("terminal-ansi-red", "#ef7b6c"),
|
||||
("terminal-ansi-green", "#a9bd7e"),
|
||||
("terminal-ansi-yellow", "#e6c46f"),
|
||||
("terminal-ansi-blue", "#8fa8e0"),
|
||||
("terminal-ansi-magenta", "#c4a0d6"),
|
||||
("terminal-ansi-magenta", "#e27ba6"),
|
||||
("terminal-ansi-cyan", "#7fbac6"),
|
||||
("terminal-ansi-white", "#d0c9c1"),
|
||||
("terminal-ansi-bright-black", "#9a928a"),
|
||||
("terminal-ansi-white", "#d3cbc4"),
|
||||
("terminal-ansi-bright-black", "#9e9499"),
|
||||
("terminal-ansi-bright-red", "#f59a8d"),
|
||||
("terminal-ansi-bright-green", "#c2d69a"),
|
||||
("terminal-ansi-bright-yellow", "#f2d88e"),
|
||||
("terminal-ansi-bright-blue", "#aebff0"),
|
||||
("terminal-ansi-bright-magenta", "#dbbde8"),
|
||||
("terminal-ansi-bright-magenta", "#f0a6c6"),
|
||||
("terminal-ansi-bright-cyan", "#a2d3dc"),
|
||||
("terminal-ansi-bright-white", "#f5f1ec"),
|
||||
("terminal-ansi-bright-white", "#f7f2ea"),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
@ -155,55 +187,65 @@ pub const LIGHT: Theme = Theme {
|
|||
label_key: "theme.lutraLight",
|
||||
dark: false,
|
||||
tokens: &[
|
||||
("bg", "#f4f1ec"),
|
||||
("editor-bg", "#fbfaf8"),
|
||||
("fg", "#2a2622"),
|
||||
("fg-muted", "#6b625a"),
|
||||
("border", "#ddd6cd"),
|
||||
("accent", "#965a22"),
|
||||
("bg", "#f3efe3"),
|
||||
("editor-bg", "#fbf9f3"),
|
||||
("fg", "#2a2427"),
|
||||
("fg-muted", "#675d61"),
|
||||
("border", "#ddd5c4"),
|
||||
("accent", "#a32c66"),
|
||||
("error", "#b23a29"),
|
||||
("statusbar-bg", "#ece7e0"),
|
||||
("statusbar-fg", "#5a5149"),
|
||||
("editor-selection-bg", "#e5d7c9"),
|
||||
("editor-active-line-bg", "#f1efed"),
|
||||
("editor-cursor", "#965a22"),
|
||||
("editor-gutter-bg", "#fbfaf8"),
|
||||
("editor-gutter-fg", "#6b625a"),
|
||||
("editor-match-bg", "#ece2d8"),
|
||||
("tab-active-bg", "#fbfaf8"),
|
||||
("tab-modified", "#965a22"),
|
||||
("notice-bg", "#e9dfd4"),
|
||||
("syntax-keyword", "#965a22"),
|
||||
("statusbar-bg", "#ebe5d5"),
|
||||
("statusbar-fg", "#554c50"),
|
||||
("editor-selection-bg", "#ecd6dc"),
|
||||
("editor-active-line-bg", "#f3f0e8"),
|
||||
("editor-cursor", "#a32c66"),
|
||||
("editor-gutter-bg", "#fbf9f3"),
|
||||
("editor-gutter-fg", "#675d61"),
|
||||
("editor-match-bg", "#f2e1e3"),
|
||||
("tab-active-bg", "#fbf9f3"),
|
||||
("tab-modified", "#a32c66"),
|
||||
("notice-bg", "#eedcdc"),
|
||||
("syntax-keyword", "#9a2d61"),
|
||||
("syntax-string", "#4e6a24"),
|
||||
("syntax-number", "#a03a4e"),
|
||||
("syntax-comment", "#6e665e"),
|
||||
("syntax-number", "#9c4519"),
|
||||
("syntax-comment", "#6b6367"),
|
||||
("syntax-variable", "#7f4a34"),
|
||||
("syntax-function", "#7a5808"),
|
||||
("syntax-type", "#24697a"),
|
||||
("syntax-constant", "#73479a"),
|
||||
("syntax-constant", "#5e489e"),
|
||||
("syntax-tag", "#a5432a"),
|
||||
("syntax-attribute", "#695d1a"),
|
||||
("syntax-operator", "#5a5149"),
|
||||
("terminal-bg", "#fbfaf8"),
|
||||
("terminal-fg", "#2a2622"),
|
||||
("terminal-cursor", "#965a22"),
|
||||
("terminal-selection-bg", "#e5d7c9"),
|
||||
("terminal-ansi-black", "#2a2622"),
|
||||
("syntax-operator", "#554c50"),
|
||||
("diag-error", "#b23a29"),
|
||||
("diag-warning", "#865500"),
|
||||
("diag-info", "#2f5aa8"),
|
||||
("diag-hint", "#675d61"),
|
||||
("vcs-added", "#3d7526"),
|
||||
("vcs-modified", "#2f5aa8"),
|
||||
("vcs-deleted", "#a3463b"),
|
||||
("vcs-untracked", "#93560c"),
|
||||
("vcs-ignored", "#71686c"),
|
||||
("vcs-conflicted", "#b01f45"),
|
||||
("terminal-bg", "#fbf9f3"),
|
||||
("terminal-fg", "#2a2427"),
|
||||
("terminal-cursor", "#a32c66"),
|
||||
("terminal-selection-bg", "#ecd6dc"),
|
||||
("terminal-ansi-black", "#2a2427"),
|
||||
("terminal-ansi-red", "#b23a29"),
|
||||
("terminal-ansi-green", "#4e6a24"),
|
||||
("terminal-ansi-yellow", "#7a5808"),
|
||||
("terminal-ansi-blue", "#2f55a4"),
|
||||
("terminal-ansi-magenta", "#73479a"),
|
||||
("terminal-ansi-magenta", "#a32c66"),
|
||||
("terminal-ansi-cyan", "#24697a"),
|
||||
("terminal-ansi-white", "#ddd6cd"),
|
||||
("terminal-ansi-bright-black", "#6b625a"),
|
||||
("terminal-ansi-white", "#ddd5c4"),
|
||||
("terminal-ansi-bright-black", "#675d61"),
|
||||
("terminal-ansi-bright-red", "#8f2a1c"),
|
||||
("terminal-ansi-bright-green", "#3b5418"),
|
||||
("terminal-ansi-bright-yellow", "#5f4404"),
|
||||
("terminal-ansi-bright-blue", "#233f7f"),
|
||||
("terminal-ansi-bright-magenta", "#5a3480"),
|
||||
("terminal-ansi-bright-magenta", "#7c1f4d"),
|
||||
("terminal-ansi-bright-cyan", "#1a5260"),
|
||||
("terminal-ansi-bright-white", "#f4f1ec"),
|
||||
("terminal-ansi-bright-white", "#f3efe3"),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
@ -363,6 +405,27 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn themes_define_the_diagnostic_and_vcs_tokens() {
|
||||
for theme in BUILTIN {
|
||||
let tokens = token_map(theme);
|
||||
for name in DIAGNOSTIC_TOKENS {
|
||||
assert!(
|
||||
tokens.contains_key(&format!("--lt-diag-{name}")),
|
||||
"{} lacks diag-{name}",
|
||||
theme.id
|
||||
);
|
||||
}
|
||||
for name in VCS_TOKENS {
|
||||
assert!(
|
||||
tokens.contains_key(&format!("--lt-vcs-{name}")),
|
||||
"{} lacks vcs-{name}",
|
||||
theme.id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolves_settings() {
|
||||
assert_eq!(resolve("lutra-light", Some(true)), LIGHT);
|
||||
|
|
@ -377,7 +440,7 @@ mod tests {
|
|||
fn renders_css_variables() {
|
||||
let css = css_variables(&DARK);
|
||||
assert!(css.starts_with(":root {"));
|
||||
assert!(css.contains(" --lt-bg: #1f1d1b;\n"));
|
||||
assert!(css.contains(" --lt-bg: #1e1b1e;\n"));
|
||||
assert!(css.contains(" --lt-font-size-ui: 13px;\n"));
|
||||
assert!(css.contains("color-scheme: dark;"));
|
||||
}
|
||||
|
|
@ -397,7 +460,7 @@ mod tests {
|
|||
let js = init_script("lutra-light");
|
||||
assert!(js.contains("\\\"Segoe UI\\\""));
|
||||
assert!(js.contains("lt-theme"));
|
||||
assert!(js.contains("--lt-bg: #f4f1ec;"));
|
||||
assert!(js.contains("--lt-bg: #f3efe3;"));
|
||||
assert_eq!(by_id("lutra-light"), Some(LIGHT));
|
||||
assert_eq!(by_id("nope"), None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn switching_the_setting_emits_the_new_tokens() {
|
|||
assert_eq!(id, "lutra-light");
|
||||
assert!(!dark);
|
||||
assert_eq!(tokens, &theme::token_map(&theme::LIGHT));
|
||||
assert_eq!(tokens["--lt-bg"], "#f4f1ec");
|
||||
assert_eq!(tokens["--lt-bg"], "#f3efe3");
|
||||
assert_eq!(tokens["--lt-font-size-editor"], "14px");
|
||||
assert!(matches!(
|
||||
outcome.events.first(),
|
||||
|
|
@ -105,7 +105,7 @@ fn system_mode_follows_the_reported_preference() {
|
|||
assert_eq!(events, []);
|
||||
assert_eq!(value["id"], "lutra-dark");
|
||||
assert_eq!(value["dark"], true);
|
||||
assert_eq!(value["tokens"]["--lt-bg"], "#1f1d1b");
|
||||
assert_eq!(value["tokens"]["--lt-bg"], "#1e1b1e");
|
||||
assert!(value.get("kind").is_none());
|
||||
|
||||
let (value, events) = report(&mut e, false);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Architecture
|
||||
|
||||
> **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction, settings, themes, the recovery journal, notifications, UI commands, the palette, the settings dialog, the app icon and the syntax layer documented; M2 highlighting and `editor.reveal`, plus the search backend, the Find tool window, the symbol index, the Structure tool window and the go-to popup; M3 CLI and single instance, LSP client library, toolchain (PHP detection, Phpactor download), the app menu, MCP server, autosave and `flushDirty`, integrated terminal; engine ↔ Phpactor wiring and diagnostics (M3.3), pending outcomes (M3.5), completion, hover and signature help (M3.4); C5 child process groups (H1), settings dialog string and path controls and assist settings (H4) · **Last updated:** 2026-10-24
|
||||
> **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction, settings, themes, the recovery journal, notifications, UI commands, the palette, the settings dialog, the app icon and the syntax layer documented; M2 highlighting and `editor.reveal`, plus the search backend, the Find tool window, the symbol index, the Structure tool window and the go-to popup; M3 CLI and single instance, LSP client library, toolchain (PHP detection, Phpactor download), the app menu, MCP server, autosave and `flushDirty`, integrated terminal; engine ↔ Phpactor wiring and diagnostics (M3.3), pending outcomes (M3.5), completion, hover and signature help (M3.4); C5 child process groups (H1), settings dialog string and path controls and assist settings (H4), the banner-aligned themes and diagnostic/VCS tokens (H5) · **Last updated:** 2026-10-25
|
||||
|
||||
## Overview
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
|
||||
- **Languages:** `ui/src/components/editor/language.ts` picks a language once per tab from the file extension (`languageOf`): PHP (`php`, `phtml`, `inc`, `php3`–`php8`, `phps`) through `@codemirror/lang-php`, whose Lezer grammar also parses the HTML, CSS and JavaScript around `<?php … ?>` blocks; HTML, CSS, JavaScript/TypeScript (with JSX), JSON, YAML and Markdown through their `@codemirror/lang-*` packages (all MIT). Other files stay plain text. The editor store passes the tab's path to `editorExtensions(path)` when it creates the tab's state.
|
||||
- **Colours:** the highlighter is a `tagHighlighter` that only sets classes: a span gets `lt-syntax-<token>` for one of the eleven tokens `keyword`, `string`, `number`, `comment`, `variable`, `function`, `type`, `constant`, `tag`, `attribute`, `operator`. The editor theme (`extensions.ts`) colours each class with its `--lt-syntax-<token>` variable. Lezer tags that are not mapped fall back to their parent tag (`controlKeyword` → `keyword`); tags without a mapped ancestor (punctuation, plain names such as the class after `extends`) keep `--lt-fg`. CodeMirror's default highlight style is never active, so no colour bypasses the tokens.
|
||||
- **Tokens:** `lutra_engine::theme::SYNTAX_TOKENS` lists the names; both themes define `syntax-*` values. It is Lutra's own palette, derived from the copper accent and the warm neutrals (keyword = accent, comment near `fg-muted`, operator = `statusbar-fg`). The contrast test checks each one at 4.5:1 on `editor-bg` and on `editor-active-line-bg` in both themes, and that the themes define no syntax token it does not check. Lowest ratios: dark comment 5.42 on the editor background and 4.86 on the active line; light keyword 5.32 and 4.84. Text on the selection colour is not held to 4.5:1 (syntax colours reach 3.06–5.96 there).
|
||||
- **Tokens:** `lutra_engine::theme::SYNTAX_TOKENS` lists the names; both themes define `syntax-*` values. It is Lutra's own palette, tuned to the raspberry accent (H5: keyword = a muted raspberry, comment near `fg-muted`, operator = `statusbar-fg`). The contrast test checks each one at 4.5:1 on `editor-bg` and on `editor-active-line-bg` in both themes, and that the themes define no syntax token it does not check. Lowest ratios: dark comment 5.42 on the editor background and 4.86 on the active line; light keyword 5.32 and 4.84. Text on the selection colour is not held to 4.5:1 (syntax colours reach 3.06–5.96 there).
|
||||
- **Two highlighters:** Lezer in the UI highlights on every keystroke without IPC; tree-sitter in `crates/syntax` (M2.1) drives outline, folding and the index. They can disagree on broken code; that is accepted (see Decisions).
|
||||
- **Performance:** keystroke to highlight on a 1 MB PHP file (30k lines), measured with `LUTRA_PERF=1 pnpm vitest run tests/editor/highlightPerf.test.ts` in jsdom (the JavaScript work of one `view.dispatch`, no layout or paint), Windows 11, three runs while other builds ran: median 3.0–3.8 ms near the top of the file and 6.3–11.4 ms in the middle; p95 10–16 ms in two runs (one disturbed run: 82 ms). The plain-text baseline is 0.4–0.6 ms. The initial full parse takes 0.7–1.5 s, which CodeMirror spreads over idle slices after the visible part. Not measured in the WebView itself yet (follow-up for `lutra perf`).
|
||||
- **`editor.reveal {path, line, column}`** (`reveal.ts`; a UI command registered through `ui.registerCommands`, label `command.editor.reveal`, provided by `EditorArea.vue`):
|
||||
|
|
@ -184,12 +184,14 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
### Themes (M1.10)
|
||||
|
||||
- `lutra_engine::theme` defines `DARK` (`lutra-dark`) and `LIGHT` (`lutra-light`) with the same token names, plus shared font tokens. Besides the base colours (`bg`, `editor-bg`, `fg`, `fg-muted`, `border`, `accent`, `error`, `statusbar-*`) both define `editor-selection-bg`, `editor-active-line-bg`, `editor-cursor`, `editor-gutter-bg`, `editor-gutter-fg`, `editor-match-bg`, `tab-active-bg`, `tab-modified`, `notice-bg`; `font-size-editor` is shared (14px). Values are opaque `#rrggbb` derived from the palette (selection, match and notice are the accent mixed into the background); the designer may change values, never names.
|
||||
- **Brand alignment (H5, approved by the owner 2026-10-25):** the palettes follow the README banner (raspberry #bc3c79, plum #83224b, cream #f2ecd7) without taking it over: surfaces stay calm and near-neutral (light: cream-tinted, `bg` #f3efe3; dark: a faint plum tint, `bg` #1e1b1e, cream `fg`), the raspberry is only the accent (light #a32c66, dark #e27ba6: cursor, modified dot, focus, active tab, selection and match tints), and the terminal follows the editor surface (ANSI magenta = accent). No new UI fonts.
|
||||
- **Diagnostic and VCS tokens (H5):** `theme::DIAGNOSTIC_TOKENS` → `--lt-diag-error|warning|info|hint` (lint underlines, gutter dots, tooltip stripes, Problems icons; warning is amber, info blue, hint muted) and `theme::VCS_TOKENS` → `--lt-vcs-added|modified|deleted|untracked|ignored|conflicted` (tree and tab file names, change markers; M4.4). Each reaches 4.5:1 on `editor-bg`, `editor-active-line-bg` and `bg` (lowest: `vcs-ignored` 4.67 dark, 4.73 light on the active line). Completion kind icons (Lucide) take `--lt-syntax-*` by kind (`assist/icons.ts` `KIND_COLOURS`), at least 3:1 on the popup and the selected row.
|
||||
- `appearance.theme` selects the theme: a theme id or `system`. `theme::resolve(setting, system_dark)` picks the theme; `system` follows the OS preference the frontend reports, and counts as dark until it has.
|
||||
- Commands: `theme.list` → `[{id, label, dark}]` (`label` is a catalog key, `theme.lutraDark`/`theme.lutraLight`); `theme.systemPreference {dark}` stores the OS preference and returns the resolved theme `{id, dark, tokens}`. Switching goes through `settings.set appearance.theme` (or `settings.reset`).
|
||||
- Event: `themeChanged {id, dark, tokens: {"--lt-…": value}}` (every token, shared ones included) whenever the resolved theme changes: after `settingsChanged` for `appearance.theme`, or after `theme.systemPreference` in system mode. A change that resolves to the same theme (`lutra-dark` → `system` on a dark OS) emits nothing.
|
||||
- First frame: the desktop reads `appearance.theme` before creating the window and passes `theme::init_script(setting)`, which installs `<style id="lt-theme">`. For `system` the CSS is the dark theme plus the light one inside `@media (prefers-color-scheme: light)`, so the first frame follows the OS without a round trip; the native window background is set from the resolved theme (`Window::theme()` for system).
|
||||
- Live switch: `ui/src/theme.ts` (`startTheme`, called by `App.vue`) reports `matchMedia("(prefers-color-scheme: dark)")` now and on every change, applies the result and every `themeChanged`: tokens go onto `:root`'s inline style (which wins over the injected style element), `color-scheme` is set, and `data-theme` holds the id. No reload.
|
||||
- Accessibility: `ui/tests/theme/contrast.test.ts` checks every text/background pair the components draw with against WCAG AA (4.5:1 text, 3:1 cursor and modified dot) in both themes. It reads `ui/tests/theme/themes.json`, which the Rust test `theme::tests::ui_snapshot_is_current` keeps equal to the Rust definition (`LUTRA_UPDATE_SNAPSHOTS=1` rewrites it). `ui/tests/theme/theme.test.ts` fails on a `var(--lt-x)` the themes lack and on a fallback for a token they define.
|
||||
- Accessibility: `ui/tests/theme/contrast.test.ts` checks every text/background pair the components draw with against WCAG AA (4.5:1 text, 3:1 cursor and modified dot) in both themes, plus the diagnostic, VCS and completion-icon colours (H5). It reads `ui/tests/theme/themes.json`, which the Rust test `theme::tests::ui_snapshot_is_current` keeps equal to the Rust definition (`LUTRA_UPDATE_SNAPSHOTS=1` rewrites it). `ui/tests/theme/theme.test.ts` fails on a `var(--lt-x)` the themes lack and on a fallback for a token they define.
|
||||
- Not themed yet: the native title bar follows the OS, not the Lutra theme; spacing and size tokens (`--lt-space-*`, `--lt-radius`, `--lt-row-height`…) are still CSS fallbacks in components. `editor.fontSize` drives `--lt-font-size-editor` since M1.9b (see Settings dialog).
|
||||
|
||||
### Recovery journal (M1.7)
|
||||
|
|
@ -385,7 +387,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
- Diagnostics are cleared (an empty `diagnosticsChanged` per file) when the session ends or the server fails, so stale ones never stay. The pump handles at most 2,000 server events per call.
|
||||
- **UI:**
|
||||
- **Editor:** `ui/src/components/editor/lint.ts` feeds CodeMirror's lint extension (`@codemirror/lint`, MIT) with wavy underlines, a gutter dot, and the message with source and code on hover.
|
||||
- Colours come only from tokens: error `--lt-error`, warning `--lt-accent`, info/hint `--lt-fg-muted`. Dedicated diagnostic tokens are a design follow-up.
|
||||
- Colours come only from the severity tokens `--lt-diag-error`, `--lt-diag-warning`, `--lt-diag-info`, `--lt-diag-hint` (H5).
|
||||
- A view plugin per editor state applies its path's list when the view shows the state and on every change. CodeMirror maps ranges through edits until the next publication.
|
||||
- **Problems:** `ui/src/components/problems/` holds the store and the tab.
|
||||
- The store loads `diagnostics.list` and `lsp.status` on start and on project open, follows the events, and hands each file to `lint.ts`.
|
||||
|
|
@ -560,6 +562,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-24 | minor | H4: string and path controls in the settings dialog (`pick_file` IPC), assist settings (auto popup, completion delay, hover delay) read live |
|
||||
| 2026-10-25 | minor | H5: banner-aligned light and dark palettes, `DIAGNOSTIC_TOKENS` and `VCS_TOKENS`, completion icon colours by kind, contrast test extended |
|
||||
| 2026-10-25 | minor | H6: isolated data directory (`--data-dir`, `LUTRA_DATA_DIR`, `--control` temp dir), shared tools dir, rendezvous order |
|
||||
| 2026-10-24 | minor | H1: `crates/proc` (L0), child processes in kill-on-close groups (Windows job objects, Unix process groups with a watchdog); Phpactor and the PHP probe use it |
|
||||
| 2026-10-22 | minor | M3.5: definition, references, rename (`lsp_nav`, workspace edits, undoable remote edits, nav UI) |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Target-app parity
|
||||
|
||||
> **Status:** M1 done (text buffer, VFS, engine workspace, project tree, tabs and a plain-text editor, recovery, palette, settings and themes in the app); M2 started: PHP syntax highlighting, find in files with its tool window, the symbol index and the go-to popup, the Structure tool window; M3 started: the integrated terminal, go to definition, find references and rename through Phpactor · **Last updated:** 2026-10-24 · **Target:** PhpStorm 2026.x
|
||||
> **Status:** M1 done (text buffer, VFS, engine workspace, project tree, tabs and a plain-text editor, recovery, palette, settings and themes in the app); M2 started: PHP syntax highlighting, find in files with its tool window, the symbol index and the go-to popup, the Structure tool window; M3 started: the integrated terminal, go to definition, find references and rename through Phpactor · **Last updated:** 2026-10-25 · **Target:** PhpStorm 2026.x
|
||||
|
||||
## How this is measured
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ Hours are the estimated agent wall-clock hours for one agent to reach behaviour
|
|||
| HTTP client | 1 | 0% | everything | ~60 (est.) | — |
|
||||
| Web languages | 2 | 0% | everything | ~200 (est.) | — |
|
||||
| Docker and remote | 1 | 0% | everything | ~120 (est.) | — |
|
||||
| Settings, keymaps, themes | 1 | 8% (est.) | nested settings tree, project-level settings, export/import, keymaps (M1.8: one global keymap from the commands' default shortcuts, not editable), colour scheme editor, custom and imported themes, per-language colours (M1.9a: settings backend with 3 keys, persistence, `settings.*` commands, no UI yet; M1.10: light and dark themes with live switching and a system mode; M1.9b: settings dialog with search, controls by type, reset, live updates, theme picker, editor font size) | ~58 (est.) | H4: every setting the engine has is editable in the dialog: string settings get a text field with in-place hints (quotes or spaces around a path, control characters, length), path settings (`php.executable`, `phpactor.path`, any key ending in `path`/`executable`, so M4.1's `git.executable` too) a "Browse…" button through the dialog plugin's native picker (desktop IPC `pick_file`); three new settings `editor.completion.autoPopup`, `editor.completion.delayMs` (0–2000), `editor.hover.delayMs` (100–3000) applied live to open editors through CodeMirror compartments; `settings.open {section?, query?}`. Tests: engine `settings::tests::assist_defaults_and_validation`, control `events.rs` defaults, Vitest `ui/tests/settings/StringSettings.test.ts` (12) and `ui/tests/editor/assist/settings.test.ts` (6, fake timers). Checked in the app on Windows 11 (bundled UI, control port 7954, screenshots read); "Browse…" not clicked live (no synthetic input), covered by Vitest |
|
||||
| Settings, keymaps, themes | 1 | 8% (est.) | nested settings tree, project-level settings, export/import, keymaps (M1.8: one global keymap from the commands' default shortcuts, not editable), colour scheme editor, custom and imported themes, per-language colours (M1.9a: settings backend with 3 keys, persistence, `settings.*` commands, no UI yet; M1.10: light and dark themes with live switching and a system mode; M1.9b: settings dialog with search, controls by type, reset, live updates, theme picker, editor font size) | ~58 (est.) | H5: both themes aligned to the README banner and approved by the owner from before/after screenshots (raspberry accent, cream-tinted light and faintly plum-tinted dark surfaces, retuned syntax colours); severity tokens `--lt-diag-*` for underlines, gutter, tooltips and Problems icons, `--lt-vcs-*` status tokens, completion icons coloured by kind; WCAG AA checked by `ui/tests/theme/contrast.test.ts` (score unchanged: no new setting or theme feature). H4: every setting the engine has is editable in the dialog: string settings get a text field with in-place hints (quotes or spaces around a path, control characters, length), path settings (`php.executable`, `phpactor.path`, any key ending in `path`/`executable`, so M4.1's `git.executable` too) a "Browse…" button through the dialog plugin's native picker (desktop IPC `pick_file`); three new settings `editor.completion.autoPopup`, `editor.completion.delayMs` (0–2000), `editor.hover.delayMs` (100–3000) applied live to open editors through CodeMirror compartments; `settings.open {section?, query?}`. Tests: engine `settings::tests::assist_defaults_and_validation`, control `events.rs` defaults, Vitest `ui/tests/settings/StringSettings.test.ts` (12) and `ui/tests/editor/assist/settings.test.ts` (6, fake timers). Checked in the app on Windows 11 (bundled UI, control port 7954, screenshots read); "Browse…" not clicked live (no synthetic input), covered by Vitest |
|
||||
| Plug-ins | 0.5 | 0% | everything | ~120 (est.) | — |
|
||||
| AI features | 0.5 | 0% | everything | ~60 (est.) | — |
|
||||
|
||||
|
|
@ -65,6 +65,7 @@ The project tree is the first user-visible feature (Project view 8%, estimated);
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-25 | minor | H5: Settings row evidence (banner-aligned themes, diagnostic and VCS tokens); score unchanged |
|
||||
| 2026-10-24 | minor | H4: Settings 7% → 8% (est.), string and path controls, completion and tooltip settings; hours 60 → 58 |
|
||||
| 2026-10-22 | minor | C4 review: breadth recounted against the feature map, 32/155 |
|
||||
| 2026-10-22 | minor | M3.5: Navigation 10% → 13% (est.), go to definition and find references; Refactoring 0% → 3% (est.), rename; hours 102 → 96 and 250 → 244 |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# UI parity checklist
|
||||
|
||||
> **Status:** main window layout (M1.5), project tree running against the engine (M1.4), editor tabs with a CodeMirror editor (M1.6), light and dark themes (M1.10), restore dialog for unsaved changes (M1.7), notification toasts (M1.12), command palette and global keymap (M1.8), settings dialog with search (M1.9b), syntax highlighting and `editor.reveal` (M2.2), Find tool window in the bottom panel (M2.4), go-to popup (M2.6), left stripe and Structure tool window (M2.7), app menu (M3.9), Terminal tool window and bottom panel tabs (M3.6), Problems tool window and editor diagnostics (M3.3), completion, quick documentation and parameter info (M3.4), string and path settings with completion and tooltip settings (H4) · **Last updated:** 2026-10-24
|
||||
> **Status:** main window layout (M1.5), project tree running against the engine (M1.4), editor tabs with a CodeMirror editor (M1.6), light and dark themes (M1.10), restore dialog for unsaved changes (M1.7), notification toasts (M1.12), command palette and global keymap (M1.8), settings dialog with search (M1.9b), syntax highlighting and `editor.reveal` (M2.2), Find tool window in the bottom panel (M2.4), go-to popup (M2.6), left stripe and Structure tool window (M2.7), app menu (M3.9), Terminal tool window and bottom panel tabs (M3.6), Problems tool window and editor diagnostics (M3.3), completion, quick documentation and parameter info (M3.4), string and path settings with completion and tooltip settings (H4), banner-aligned themes with diagnostic and VCS colours (H5) · **Last updated:** 2026-10-25
|
||||
|
||||
- [ ] Main window: tool window stripes, editor area, status bar, navigation bar
|
||||
- M2.7 (2026-10-17): a left stripe with one tab per left tool window (Project, Structure); the shown one is marked, clicking it again hides the window. Still missing: right docking, several bottom tool windows, drag to rearrange, navigation bar, layout persistence.
|
||||
|
|
@ -24,7 +24,8 @@
|
|||
- [ ] Keymap editor (Lutra's own default keymap; no copied keymaps)
|
||||
- M1.8 (2026-10-16): the global keymap built from the default shortcuts of engine and UI commands; no user keymap and no editor yet.
|
||||
- [ ] Light and dark themes from theme tokens
|
||||
- M1.10 (2026-10-16): Lutra Dark and Lutra Light from Rust tokens, switched live through `appearance.theme` (no reload), `system` follows the OS preference, the first frame uses the stored theme; the editor (selection, active line, cursor, gutter, matches), tabs and notices have their own tokens; WCAG AA contrast checked by Vitest for every text pair in both themes. Covered by Vitest DOM and control-channel tests; live check pending (gaming mode). M1.9b: theme picker in the settings dialog, editor font size from `editor.fontSize`. Missing: a theme command in the palette, the native title bar following the theme, colour scheme editor, high-contrast theme, design review of the values.
|
||||
- M1.10 (2026-10-16): Lutra Dark and Lutra Light from Rust tokens, switched live through `appearance.theme` (no reload), `system` follows the OS preference, the first frame uses the stored theme; the editor (selection, active line, cursor, gutter, matches), tabs and notices have their own tokens; WCAG AA contrast checked by Vitest for every text pair in both themes. Covered by Vitest DOM and control-channel tests; live check pending (gaming mode). M1.9b: theme picker in the settings dialog, editor font size from `editor.fontSize`. Missing: a theme command in the palette, the native title bar following the theme, colour scheme editor, high-contrast theme.
|
||||
- H5 (2026-10-25): both themes follow the README banner, approved by the owner from before/after screenshots (tree, PHP editor, Problems, terminal, palette, settings; Windows 11, bundled UI, control port 7955): cream-tinted light theme, faintly plum-tinted dark theme, raspberry only as the accent, retuned syntax colours, the terminal on the editor surface. Diagnostics get their own colours (`--lt-diag-*`: error, amber warning, blue info, muted hint) in the underline, gutter dot, tooltip stripe and Problems icon; `--lt-vcs-*` status colours for M4.4; completion kind icons coloured by kind. Every text colour ≥ 4.5:1 and icon colour ≥ 3:1 in both themes (Vitest contrast test).
|
||||
- [ ] Notifications and background task indicator
|
||||
- M1.12 (2026-10-16): toasts at the bottom right for engine and host notifications (corrupt settings and journal entries at startup, folder that cannot be opened, `unsaved_changes` when switching projects, file watching stopped, failed commands without their own UI): info dismissed after 5 s, warnings and errors stay until closed, close button and Escape, at most 5 visible with "+n more", `role="status"`/`role="alert"`; startup notifications are replayed when the page starts listening. Vitest (19 store and component tests); live check pending (gaming mode). Missing: a notification log / Notifications tool window, actions inside a toast, balloon grouping, "don't show again", background task indicator with progress.
|
||||
- [ ] Structure tool window
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-25 | minor | Themes: banner-aligned palettes, diagnostic and VCS colours, completion icon colours (H5) |
|
||||
| 2026-10-24 | minor | Settings dialog: string and path controls, completion and tooltip settings (H4) |
|
||||
| 2026-10-22 | minor | Completion popup, quick documentation and parameter info partial (M3.4) |
|
||||
| 2026-10-21 | minor | Problems tool window partial, editor diagnostics (M3.3) |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* Lucide icons (ISC) for completion item kinds, rendered into plain DOM
|
||||
* nodes for CodeMirror's completion list. The icon has the kind's catalog
|
||||
* name as its tooltip; its colour is the list's text colour.
|
||||
* name as its tooltip. Kinds that name code take the syntax colour of what
|
||||
* they name (functions, types, variables, constants, keywords), as the
|
||||
* Structure window does; the rest stay muted.
|
||||
*/
|
||||
import {
|
||||
Box,
|
||||
|
|
@ -58,6 +60,39 @@ export const KIND_ICONS: Readonly<Record<CompletionKind, VueComponent>> = {
|
|||
typeParameter: Type,
|
||||
};
|
||||
|
||||
/**
|
||||
* The colour token of each kind: a `--lt-syntax-*` token for kinds that
|
||||
* name code, `--lt-fg-muted` for the rest. Each reaches 3:1 on the popup
|
||||
* and on the selected row (`ui/tests/theme/contrast.test.ts`).
|
||||
*/
|
||||
export const KIND_COLOURS: Readonly<Record<CompletionKind, string>> = {
|
||||
text: "fg-muted",
|
||||
method: "syntax-function",
|
||||
function: "syntax-function",
|
||||
constructor: "syntax-function",
|
||||
field: "syntax-variable",
|
||||
variable: "syntax-variable",
|
||||
class: "syntax-type",
|
||||
interface: "syntax-type",
|
||||
module: "syntax-type",
|
||||
property: "syntax-variable",
|
||||
unit: "fg-muted",
|
||||
value: "syntax-constant",
|
||||
enum: "syntax-type",
|
||||
keyword: "syntax-keyword",
|
||||
snippet: "fg-muted",
|
||||
color: "fg-muted",
|
||||
file: "fg-muted",
|
||||
reference: "fg-muted",
|
||||
folder: "fg-muted",
|
||||
enumMember: "syntax-constant",
|
||||
constant: "syntax-constant",
|
||||
struct: "syntax-type",
|
||||
event: "fg-muted",
|
||||
operator: "syntax-operator",
|
||||
typeParameter: "syntax-type",
|
||||
};
|
||||
|
||||
/** The catalog name of each kind, shown as the icon's tooltip. */
|
||||
export const KIND_LABELS: Readonly<Record<CompletionKind, () => string>> = {
|
||||
text: () => t("editor.assist.kind.text"),
|
||||
|
|
@ -99,6 +134,7 @@ export function kindIcon(kind: string, owner: Document = document): HTMLElement
|
|||
const span = owner.createElement("span");
|
||||
span.className = `lt-assist-kind lt-assist-kind-${known}`;
|
||||
span.title = KIND_LABELS[known]();
|
||||
span.style.color = `var(--lt-${KIND_COLOURS[known]})`;
|
||||
render(h(KIND_ICONS[known], { size: 14, "aria-hidden": "true" }), span);
|
||||
return span;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
*
|
||||
* Positions are 0-based lines with UTF-16 columns, converted with
|
||||
* {@link positionOf} (CRLF-safe, clamped to the document). Colours come
|
||||
* from tokens: errors `--lt-error`, warnings `--lt-accent`, information and
|
||||
* hints `--lt-fg-muted`.
|
||||
* from the severity tokens `--lt-diag-error`, `--lt-diag-warning`,
|
||||
* `--lt-diag-info` and `--lt-diag-hint`.
|
||||
*
|
||||
* @see useProblemsStore in `../problems/problems.ts`.
|
||||
*/
|
||||
|
|
@ -173,23 +173,27 @@ function marker(colour: string): Record<string, string> {
|
|||
|
||||
/** Lint colours from tokens, replacing CodeMirror's built-in ones. */
|
||||
const lintTheme: Extension = EditorView.theme({
|
||||
".cm-lintRange-error": underline("var(--lt-error)"),
|
||||
".cm-lintRange-warning": underline("var(--lt-accent)"),
|
||||
".cm-lintRange-info, .cm-lintRange-hint": underline("var(--lt-fg-muted)"),
|
||||
".cm-lintRange-error": underline("var(--lt-diag-error)"),
|
||||
".cm-lintRange-warning": underline("var(--lt-diag-warning)"),
|
||||
".cm-lintRange-info": underline("var(--lt-diag-info)"),
|
||||
".cm-lintRange-hint": underline("var(--lt-diag-hint)"),
|
||||
".cm-lintRange-active": { backgroundColor: "var(--lt-editor-match-bg)" },
|
||||
".cm-lintPoint:after": { borderBottomColor: "var(--lt-error)" },
|
||||
".cm-lintPoint-warning:after": { borderBottomColor: "var(--lt-accent)" },
|
||||
".cm-lintPoint-info:after, .cm-lintPoint-hint:after": { borderBottomColor: "var(--lt-fg-muted)" },
|
||||
".cm-lintPoint:after": { borderBottomColor: "var(--lt-diag-error)" },
|
||||
".cm-lintPoint-warning:after": { borderBottomColor: "var(--lt-diag-warning)" },
|
||||
".cm-lintPoint-info:after": { borderBottomColor: "var(--lt-diag-info)" },
|
||||
".cm-lintPoint-hint:after": { borderBottomColor: "var(--lt-diag-hint)" },
|
||||
".cm-gutter-lint": { width: "14px" },
|
||||
".cm-gutter-lint .cm-gutterElement": { display: "flex", alignItems: "center", padding: "0" },
|
||||
".cm-lint-marker": { width: "8px", height: "8px" },
|
||||
".cm-lint-marker-error": marker("var(--lt-error)"),
|
||||
".cm-lint-marker-warning": marker("var(--lt-accent)"),
|
||||
".cm-lint-marker-info, .cm-lint-marker-hint": marker("var(--lt-fg-muted)"),
|
||||
".cm-lint-marker-error": marker("var(--lt-diag-error)"),
|
||||
".cm-lint-marker-warning": marker("var(--lt-diag-warning)"),
|
||||
".cm-lint-marker-info": marker("var(--lt-diag-info)"),
|
||||
".cm-lint-marker-hint": marker("var(--lt-diag-hint)"),
|
||||
".cm-diagnostic": { padding: "4px 8px", color: "var(--lt-fg)", whiteSpace: "pre-wrap" },
|
||||
".cm-diagnostic-error": { borderLeft: "3px solid var(--lt-error)" },
|
||||
".cm-diagnostic-warning": { borderLeft: "3px solid var(--lt-accent)" },
|
||||
".cm-diagnostic-info, .cm-diagnostic-hint": { borderLeft: "3px solid var(--lt-fg-muted)" },
|
||||
".cm-diagnostic-error": { borderLeft: "3px solid var(--lt-diag-error)" },
|
||||
".cm-diagnostic-warning": { borderLeft: "3px solid var(--lt-diag-warning)" },
|
||||
".cm-diagnostic-info": { borderLeft: "3px solid var(--lt-diag-info)" },
|
||||
".cm-diagnostic-hint": { borderLeft: "3px solid var(--lt-diag-hint)" },
|
||||
".cm-diagnosticSource": { color: "var(--lt-fg-muted)", opacity: "1" },
|
||||
".cm-tooltip-lint": { maxWidth: "640px" },
|
||||
".cm-panel.cm-panel-lint": { backgroundColor: "var(--lt-bg)", color: "var(--lt-fg)" },
|
||||
|
|
|
|||
|
|
@ -344,16 +344,19 @@ watch(
|
|||
}
|
||||
|
||||
.problems__icon--error {
|
||||
color: var(--lt-error);
|
||||
color: var(--lt-diag-error);
|
||||
}
|
||||
|
||||
.problems__icon--warning {
|
||||
color: var(--lt-accent);
|
||||
color: var(--lt-diag-warning);
|
||||
}
|
||||
|
||||
.problems__icon--info {
|
||||
color: var(--lt-diag-info);
|
||||
}
|
||||
|
||||
.problems__icon--info,
|
||||
.problems__icon--hint {
|
||||
color: var(--lt-fg-muted);
|
||||
color: var(--lt-diag-hint);
|
||||
}
|
||||
|
||||
.problems__message {
|
||||
|
|
|
|||
|
|
@ -6,12 +6,17 @@
|
|||
* syntax colour (`--lt-syntax-*`) reaches 4.5:1 on the editor background
|
||||
* and on the active line. The terminal's text, cursor and every ANSI colour
|
||||
* that shows as text reach AA on the terminal background (M3.6); the colour
|
||||
* meant to vanish into it is exempt per theme (`TERMINAL_EXEMPT`). The
|
||||
* meant to vanish into it is exempt per theme (`TERMINAL_EXEMPT`). Every
|
||||
* diagnostic severity (`--lt-diag-*`) and version-control status
|
||||
* (`--lt-vcs-*`) colour reaches 4.5:1 on the editor background, the active
|
||||
* line and the window background, and every completion kind icon colour
|
||||
* reaches 3:1 on the popup and its selected row (H5). The
|
||||
* themes come from
|
||||
* `themes.json`, a snapshot that the Rust test `ui_snapshot_is_current`
|
||||
* keeps equal to `lutra_engine::theme`.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { KIND_COLOURS } from "../../src/components/editor/assist/icons";
|
||||
import themes from "./themes.json";
|
||||
|
||||
/** Minimum ratio for normal-size text (AA). */
|
||||
|
|
@ -68,6 +73,29 @@ const SYNTAX_PAIRS: [string, string, number][] = SYNTAX.flatMap((name): [string,
|
|||
[`syntax-${name}`, "editor-active-line-bg", TEXT],
|
||||
]);
|
||||
|
||||
/** Diagnostic severity names (`--lt-diag-<name>`), as `DIAGNOSTIC_TOKENS` in `theme.rs`. */
|
||||
export const DIAGNOSTIC = ["error", "warning", "info", "hint"] as const;
|
||||
|
||||
/** Version-control status names (`--lt-vcs-<name>`), as `VCS_TOKENS` in `theme.rs`. */
|
||||
export const VCS = ["added", "modified", "deleted", "untracked", "ignored", "conflicted"] as const;
|
||||
|
||||
/** Backgrounds the diagnostic and status colours are drawn on as text or marks. */
|
||||
const STATUS_BACKGROUNDS = ["editor-bg", "editor-active-line-bg", "bg"] as const;
|
||||
|
||||
/** Every diagnostic and status colour on each of its backgrounds. */
|
||||
const STATUS_PAIRS: [string, string, number][] = [
|
||||
...DIAGNOSTIC.map((name) => `diag-${name}`),
|
||||
...VCS.map((name) => `vcs-${name}`),
|
||||
].flatMap((fg) => STATUS_BACKGROUNDS.map((bg): [string, string, number] => [fg, bg, TEXT]));
|
||||
|
||||
/** Every completion kind icon colour on the popup and its selected row. */
|
||||
const KIND_PAIRS: [string, string, number][] = [...new Set(Object.values(KIND_COLOURS))].flatMap(
|
||||
(fg): [string, string, number][] => [
|
||||
[fg, "bg", LARGE],
|
||||
[fg, "editor-selection-bg", LARGE],
|
||||
],
|
||||
);
|
||||
|
||||
/** ANSI colour names, as in `TERMINAL_TOKENS` in `theme.rs`. */
|
||||
const ANSI = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"] as const;
|
||||
|
||||
|
|
@ -153,12 +181,22 @@ describe.each(themes)("theme $id", (theme) => {
|
|||
expect(defined).toEqual([...SYNTAX].sort());
|
||||
});
|
||||
|
||||
it("checks every diagnostic and status token it defines", () => {
|
||||
const defined = (prefix: string): string[] =>
|
||||
Object.keys(tokens)
|
||||
.filter((name) => name.startsWith(prefix))
|
||||
.map((name) => name.slice(prefix.length))
|
||||
.sort();
|
||||
expect(defined("--lt-diag-")).toEqual([...DIAGNOSTIC].sort());
|
||||
expect(defined("--lt-vcs-")).toEqual([...VCS].sort());
|
||||
});
|
||||
|
||||
it("checks every terminal ANSI token it defines", () => {
|
||||
const defined = Object.keys(tokens).filter((name) => name.startsWith("--lt-terminal-ansi-"));
|
||||
expect(defined).toHaveLength(ANSI.length * 2);
|
||||
});
|
||||
|
||||
it.each([...PAIRS, ...SYNTAX_PAIRS, ...terminalPairs(theme.id)])("%s on %s reaches %d:1", (fg, bg, min) => {
|
||||
it.each([...PAIRS, ...SYNTAX_PAIRS, ...STATUS_PAIRS, ...KIND_PAIRS, ...terminalPairs(theme.id)])("%s on %s reaches %d:1", (fg, bg, min) => {
|
||||
expect(contrast(token(fg), token(bg))).toBeGreaterThanOrEqual(min);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ describe("applyTheme", () => {
|
|||
expect(root.dataset.theme).toBe("lutra-light");
|
||||
|
||||
applyTheme(byId("lutra-dark"));
|
||||
expect(root.style.getPropertyValue("--lt-bg")).toBe("#1f1d1b");
|
||||
expect(root.style.getPropertyValue("--lt-editor-selection-bg")).toBe("#513f2c");
|
||||
expect(root.style.getPropertyValue("--lt-bg")).toBe("#1e1b1e");
|
||||
expect(root.style.getPropertyValue("--lt-editor-selection-bg")).toBe("#4c2d3d");
|
||||
expect(root.style.colorScheme).toBe("dark");
|
||||
});
|
||||
});
|
||||
|
|
@ -121,7 +121,7 @@ describe("startTheme", () => {
|
|||
media.change(true);
|
||||
await flushPromises();
|
||||
expect(root.dataset.theme).toBe("lutra-dark");
|
||||
expect(root.style.getPropertyValue("--lt-bg")).toBe("#1f1d1b");
|
||||
expect(root.style.getPropertyValue("--lt-bg")).toBe("#1e1b1e");
|
||||
|
||||
stop();
|
||||
expect(media.handlers.size).toBe(0);
|
||||
|
|
@ -135,7 +135,7 @@ describe("startTheme", () => {
|
|||
expect(emit).toBeDefined();
|
||||
emit?.({ payload: { kind: "themeChanged", ...byId("lutra-light") } });
|
||||
expect(root.dataset.theme).toBe("lutra-light");
|
||||
expect(root.style.getPropertyValue("--lt-notice-bg")).toBe("#e9dfd4");
|
||||
expect(root.style.getPropertyValue("--lt-notice-bg")).toBe("#eedcdc");
|
||||
emit?.({ payload: { kind: "treeChanged", dir: "" } });
|
||||
expect(root.dataset.theme).toBe("lutra-light");
|
||||
stop();
|
||||
|
|
|
|||
|
|
@ -4,60 +4,70 @@
|
|||
"id": "lutra-dark",
|
||||
"labelKey": "theme.lutraDark",
|
||||
"tokens": {
|
||||
"--lt-accent": "#d39a5c",
|
||||
"--lt-bg": "#1f1d1b",
|
||||
"--lt-border": "#34302c",
|
||||
"--lt-editor-active-line-bg": "#232221",
|
||||
"--lt-editor-bg": "#191817",
|
||||
"--lt-editor-cursor": "#d39a5c",
|
||||
"--lt-editor-gutter-bg": "#191817",
|
||||
"--lt-editor-gutter-fg": "#9a928a",
|
||||
"--lt-editor-match-bg": "#3a2f23",
|
||||
"--lt-editor-selection-bg": "#513f2c",
|
||||
"--lt-error": "#ef7b6c",
|
||||
"--lt-fg": "#e6e1da",
|
||||
"--lt-fg-muted": "#9a928a",
|
||||
"--lt-accent": "#e27ba6",
|
||||
"--lt-bg": "#1e1b1e",
|
||||
"--lt-border": "#362f35",
|
||||
"--lt-diag-error": "#f2836b",
|
||||
"--lt-diag-hint": "#9e9499",
|
||||
"--lt-diag-info": "#8fb0e8",
|
||||
"--lt-diag-warning": "#e6b450",
|
||||
"--lt-editor-active-line-bg": "#221f22",
|
||||
"--lt-editor-bg": "#181618",
|
||||
"--lt-editor-cursor": "#e27ba6",
|
||||
"--lt-editor-gutter-bg": "#181618",
|
||||
"--lt-editor-gutter-fg": "#9e9499",
|
||||
"--lt-editor-match-bg": "#3a2632",
|
||||
"--lt-editor-selection-bg": "#4c2d3d",
|
||||
"--lt-error": "#f2836b",
|
||||
"--lt-fg": "#ebe5dc",
|
||||
"--lt-fg-muted": "#9e9499",
|
||||
"--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace",
|
||||
"--lt-font-size-editor": "14px",
|
||||
"--lt-font-size-small": "12px",
|
||||
"--lt-font-size-ui": "13px",
|
||||
"--lt-font-ui": "system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, sans-serif",
|
||||
"--lt-notice-bg": "#3a3025",
|
||||
"--lt-statusbar-bg": "#24211f",
|
||||
"--lt-statusbar-fg": "#b8afa6",
|
||||
"--lt-notice-bg": "#382632",
|
||||
"--lt-statusbar-bg": "#231f23",
|
||||
"--lt-statusbar-fg": "#bdb3b8",
|
||||
"--lt-syntax-attribute": "#cdb87e",
|
||||
"--lt-syntax-comment": "#958d84",
|
||||
"--lt-syntax-constant": "#c4a0d6",
|
||||
"--lt-syntax-comment": "#978e93",
|
||||
"--lt-syntax-constant": "#b9a5e2",
|
||||
"--lt-syntax-function": "#e6c46f",
|
||||
"--lt-syntax-keyword": "#d39a5c",
|
||||
"--lt-syntax-number": "#e3a1a8",
|
||||
"--lt-syntax-operator": "#b8afa6",
|
||||
"--lt-syntax-keyword": "#d98aab",
|
||||
"--lt-syntax-number": "#e8a87c",
|
||||
"--lt-syntax-operator": "#bdb3b8",
|
||||
"--lt-syntax-string": "#a9bd7e",
|
||||
"--lt-syntax-tag": "#e08b70",
|
||||
"--lt-syntax-type": "#7fbac6",
|
||||
"--lt-syntax-variable": "#d8bba6",
|
||||
"--lt-tab-active-bg": "#191817",
|
||||
"--lt-tab-modified": "#d39a5c",
|
||||
"--lt-terminal-ansi-black": "#2e2b28",
|
||||
"--lt-syntax-variable": "#dcc6b2",
|
||||
"--lt-tab-active-bg": "#181618",
|
||||
"--lt-tab-modified": "#e27ba6",
|
||||
"--lt-terminal-ansi-black": "#2e2a2e",
|
||||
"--lt-terminal-ansi-blue": "#8fa8e0",
|
||||
"--lt-terminal-ansi-bright-black": "#9a928a",
|
||||
"--lt-terminal-ansi-bright-black": "#9e9499",
|
||||
"--lt-terminal-ansi-bright-blue": "#aebff0",
|
||||
"--lt-terminal-ansi-bright-cyan": "#a2d3dc",
|
||||
"--lt-terminal-ansi-bright-green": "#c2d69a",
|
||||
"--lt-terminal-ansi-bright-magenta": "#dbbde8",
|
||||
"--lt-terminal-ansi-bright-magenta": "#f0a6c6",
|
||||
"--lt-terminal-ansi-bright-red": "#f59a8d",
|
||||
"--lt-terminal-ansi-bright-white": "#f5f1ec",
|
||||
"--lt-terminal-ansi-bright-white": "#f7f2ea",
|
||||
"--lt-terminal-ansi-bright-yellow": "#f2d88e",
|
||||
"--lt-terminal-ansi-cyan": "#7fbac6",
|
||||
"--lt-terminal-ansi-green": "#a9bd7e",
|
||||
"--lt-terminal-ansi-magenta": "#c4a0d6",
|
||||
"--lt-terminal-ansi-magenta": "#e27ba6",
|
||||
"--lt-terminal-ansi-red": "#ef7b6c",
|
||||
"--lt-terminal-ansi-white": "#d0c9c1",
|
||||
"--lt-terminal-ansi-white": "#d3cbc4",
|
||||
"--lt-terminal-ansi-yellow": "#e6c46f",
|
||||
"--lt-terminal-bg": "#191817",
|
||||
"--lt-terminal-cursor": "#d39a5c",
|
||||
"--lt-terminal-fg": "#e6e1da",
|
||||
"--lt-terminal-selection-bg": "#513f2c"
|
||||
"--lt-terminal-bg": "#181618",
|
||||
"--lt-terminal-cursor": "#e27ba6",
|
||||
"--lt-terminal-fg": "#ebe5dc",
|
||||
"--lt-terminal-selection-bg": "#4c2d3d",
|
||||
"--lt-vcs-added": "#9cc27a",
|
||||
"--lt-vcs-conflicted": "#f26d82",
|
||||
"--lt-vcs-deleted": "#d4908a",
|
||||
"--lt-vcs-ignored": "#8f878b",
|
||||
"--lt-vcs-modified": "#8fb0e8",
|
||||
"--lt-vcs-untracked": "#e3a464"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -65,60 +75,70 @@
|
|||
"id": "lutra-light",
|
||||
"labelKey": "theme.lutraLight",
|
||||
"tokens": {
|
||||
"--lt-accent": "#965a22",
|
||||
"--lt-bg": "#f4f1ec",
|
||||
"--lt-border": "#ddd6cd",
|
||||
"--lt-editor-active-line-bg": "#f1efed",
|
||||
"--lt-editor-bg": "#fbfaf8",
|
||||
"--lt-editor-cursor": "#965a22",
|
||||
"--lt-editor-gutter-bg": "#fbfaf8",
|
||||
"--lt-editor-gutter-fg": "#6b625a",
|
||||
"--lt-editor-match-bg": "#ece2d8",
|
||||
"--lt-editor-selection-bg": "#e5d7c9",
|
||||
"--lt-accent": "#a32c66",
|
||||
"--lt-bg": "#f3efe3",
|
||||
"--lt-border": "#ddd5c4",
|
||||
"--lt-diag-error": "#b23a29",
|
||||
"--lt-diag-hint": "#675d61",
|
||||
"--lt-diag-info": "#2f5aa8",
|
||||
"--lt-diag-warning": "#865500",
|
||||
"--lt-editor-active-line-bg": "#f3f0e8",
|
||||
"--lt-editor-bg": "#fbf9f3",
|
||||
"--lt-editor-cursor": "#a32c66",
|
||||
"--lt-editor-gutter-bg": "#fbf9f3",
|
||||
"--lt-editor-gutter-fg": "#675d61",
|
||||
"--lt-editor-match-bg": "#f2e1e3",
|
||||
"--lt-editor-selection-bg": "#ecd6dc",
|
||||
"--lt-error": "#b23a29",
|
||||
"--lt-fg": "#2a2622",
|
||||
"--lt-fg-muted": "#6b625a",
|
||||
"--lt-fg": "#2a2427",
|
||||
"--lt-fg-muted": "#675d61",
|
||||
"--lt-font-mono": "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace",
|
||||
"--lt-font-size-editor": "14px",
|
||||
"--lt-font-size-small": "12px",
|
||||
"--lt-font-size-ui": "13px",
|
||||
"--lt-font-ui": "system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, sans-serif",
|
||||
"--lt-notice-bg": "#e9dfd4",
|
||||
"--lt-statusbar-bg": "#ece7e0",
|
||||
"--lt-statusbar-fg": "#5a5149",
|
||||
"--lt-notice-bg": "#eedcdc",
|
||||
"--lt-statusbar-bg": "#ebe5d5",
|
||||
"--lt-statusbar-fg": "#554c50",
|
||||
"--lt-syntax-attribute": "#695d1a",
|
||||
"--lt-syntax-comment": "#6e665e",
|
||||
"--lt-syntax-constant": "#73479a",
|
||||
"--lt-syntax-comment": "#6b6367",
|
||||
"--lt-syntax-constant": "#5e489e",
|
||||
"--lt-syntax-function": "#7a5808",
|
||||
"--lt-syntax-keyword": "#965a22",
|
||||
"--lt-syntax-number": "#a03a4e",
|
||||
"--lt-syntax-operator": "#5a5149",
|
||||
"--lt-syntax-keyword": "#9a2d61",
|
||||
"--lt-syntax-number": "#9c4519",
|
||||
"--lt-syntax-operator": "#554c50",
|
||||
"--lt-syntax-string": "#4e6a24",
|
||||
"--lt-syntax-tag": "#a5432a",
|
||||
"--lt-syntax-type": "#24697a",
|
||||
"--lt-syntax-variable": "#7f4a34",
|
||||
"--lt-tab-active-bg": "#fbfaf8",
|
||||
"--lt-tab-modified": "#965a22",
|
||||
"--lt-terminal-ansi-black": "#2a2622",
|
||||
"--lt-tab-active-bg": "#fbf9f3",
|
||||
"--lt-tab-modified": "#a32c66",
|
||||
"--lt-terminal-ansi-black": "#2a2427",
|
||||
"--lt-terminal-ansi-blue": "#2f55a4",
|
||||
"--lt-terminal-ansi-bright-black": "#6b625a",
|
||||
"--lt-terminal-ansi-bright-black": "#675d61",
|
||||
"--lt-terminal-ansi-bright-blue": "#233f7f",
|
||||
"--lt-terminal-ansi-bright-cyan": "#1a5260",
|
||||
"--lt-terminal-ansi-bright-green": "#3b5418",
|
||||
"--lt-terminal-ansi-bright-magenta": "#5a3480",
|
||||
"--lt-terminal-ansi-bright-magenta": "#7c1f4d",
|
||||
"--lt-terminal-ansi-bright-red": "#8f2a1c",
|
||||
"--lt-terminal-ansi-bright-white": "#f4f1ec",
|
||||
"--lt-terminal-ansi-bright-white": "#f3efe3",
|
||||
"--lt-terminal-ansi-bright-yellow": "#5f4404",
|
||||
"--lt-terminal-ansi-cyan": "#24697a",
|
||||
"--lt-terminal-ansi-green": "#4e6a24",
|
||||
"--lt-terminal-ansi-magenta": "#73479a",
|
||||
"--lt-terminal-ansi-magenta": "#a32c66",
|
||||
"--lt-terminal-ansi-red": "#b23a29",
|
||||
"--lt-terminal-ansi-white": "#ddd6cd",
|
||||
"--lt-terminal-ansi-white": "#ddd5c4",
|
||||
"--lt-terminal-ansi-yellow": "#7a5808",
|
||||
"--lt-terminal-bg": "#fbfaf8",
|
||||
"--lt-terminal-cursor": "#965a22",
|
||||
"--lt-terminal-fg": "#2a2622",
|
||||
"--lt-terminal-selection-bg": "#e5d7c9"
|
||||
"--lt-terminal-bg": "#fbf9f3",
|
||||
"--lt-terminal-cursor": "#a32c66",
|
||||
"--lt-terminal-fg": "#2a2427",
|
||||
"--lt-terminal-selection-bg": "#ecd6dc",
|
||||
"--lt-vcs-added": "#3d7526",
|
||||
"--lt-vcs-conflicted": "#b01f45",
|
||||
"--lt-vcs-deleted": "#a3463b",
|
||||
"--lt-vcs-ignored": "#71686c",
|
||||
"--lt-vcs-modified": "#2f5aa8",
|
||||
"--lt-vcs-untracked": "#93560c"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue