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
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue