M1.10: light theme, live theme switching, editor tokens
- theme::LIGHT next to DARK with the 10 new tokens (editor selection, active line, cursor, gutter, match, font size, tab active/modified, notice); light fg-muted, accent and error darkened for WCAG AA - theme.list, theme.systemPreference, themeChanged event when the resolved theme changes (settings.set/reset appearance.theme, or the OS preference in system mode) - desktop init script and window background from the stored setting; system mode uses a prefers-color-scheme media query for the first frame - ui/src/theme.ts applies tokens to :root and color-scheme live; editor, tabs and notice drop their var() fallbacks - Vitest WCAG AA contrast check against a Rust-maintained snapshot, DOM tests, headless control-channel test - docs: architecture Themes, parity rows, ui-parity, gaps, roadmaps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1ab448de4d
commit
cde6e119c6
29 changed files with 1192 additions and 72 deletions
|
|
@ -139,7 +139,7 @@ onBeforeUnmount(() => {
|
|||
padding: 4px 12px;
|
||||
flex-shrink: 0;
|
||||
color: var(--lt-fg);
|
||||
background: var(--lt-notice-bg, color-mix(in srgb, var(--lt-accent) 15%, var(--lt-bg)));
|
||||
background: var(--lt-notice-bg);
|
||||
border-bottom: 1px solid var(--lt-border);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
|
||||
.tabs__tab--active {
|
||||
color: var(--lt-fg);
|
||||
background: var(--lt-tab-active-bg, var(--lt-editor-bg));
|
||||
background: var(--lt-tab-active-bg);
|
||||
border-bottom-color: var(--lt-accent);
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--lt-tab-modified, var(--lt-accent));
|
||||
background: var(--lt-tab-modified);
|
||||
}
|
||||
|
||||
.tabs__close {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
/**
|
||||
* CodeMirror extensions of the Lutra editor: the basic setup (line numbers,
|
||||
* history, selection, brackets, search) without a language (PHP comes in
|
||||
* M2), and a theme that takes every colour from `--lt-*` tokens.
|
||||
*
|
||||
* Tokens the theme does not define yet are read with a fallback derived from
|
||||
* existing tokens (`var(--lt-editor-selection-bg, color-mix(…))`), so that a
|
||||
* token added to the Rust theme later takes effect without code changes.
|
||||
* Requested from design: `--lt-editor-selection-bg`,
|
||||
* `--lt-editor-active-line-bg`, `--lt-editor-cursor`, `--lt-editor-gutter-bg`,
|
||||
* `--lt-editor-gutter-fg`, `--lt-editor-match-bg`, `--lt-font-size-editor`.
|
||||
* M2), and a theme that takes every colour from `--lt-*` tokens, including
|
||||
* the editor tokens (`--lt-editor-selection-bg`, `--lt-editor-active-line-bg`,
|
||||
* `--lt-editor-cursor`, `--lt-editor-gutter-bg`, `--lt-editor-gutter-fg`,
|
||||
* `--lt-editor-match-bg`, `--lt-font-size-editor`).
|
||||
*/
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import type { Extension } from "@codemirror/state";
|
||||
|
|
@ -20,7 +16,7 @@ export const lutraEditorTheme: Extension = EditorView.theme({
|
|||
height: "100%",
|
||||
color: "var(--lt-fg)",
|
||||
backgroundColor: "var(--lt-editor-bg)",
|
||||
fontSize: "var(--lt-font-size-editor, var(--lt-font-size-ui))",
|
||||
fontSize: "var(--lt-font-size-editor)",
|
||||
},
|
||||
"&.cm-focused": {
|
||||
outline: "none",
|
||||
|
|
@ -30,37 +26,32 @@ export const lutraEditorTheme: Extension = EditorView.theme({
|
|||
lineHeight: "1.5",
|
||||
},
|
||||
".cm-content": {
|
||||
caretColor: "var(--lt-editor-cursor, var(--lt-accent))",
|
||||
caretColor: "var(--lt-editor-cursor)",
|
||||
},
|
||||
".cm-cursor, .cm-dropCursor": {
|
||||
borderLeftColor: "var(--lt-editor-cursor, var(--lt-accent))",
|
||||
borderLeftColor: "var(--lt-editor-cursor)",
|
||||
},
|
||||
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":
|
||||
{
|
||||
backgroundColor:
|
||||
"var(--lt-editor-selection-bg, color-mix(in srgb, var(--lt-accent) 30%, transparent))",
|
||||
backgroundColor: "var(--lt-editor-selection-bg)",
|
||||
},
|
||||
".cm-activeLine": {
|
||||
backgroundColor:
|
||||
"var(--lt-editor-active-line-bg, color-mix(in srgb, var(--lt-fg) 5%, transparent))",
|
||||
backgroundColor: "var(--lt-editor-active-line-bg)",
|
||||
},
|
||||
".cm-selectionMatch, .cm-searchMatch": {
|
||||
backgroundColor:
|
||||
"var(--lt-editor-match-bg, color-mix(in srgb, var(--lt-accent) 18%, transparent))",
|
||||
backgroundColor: "var(--lt-editor-match-bg)",
|
||||
},
|
||||
"&.cm-focused .cm-matchingBracket": {
|
||||
backgroundColor:
|
||||
"var(--lt-editor-match-bg, color-mix(in srgb, var(--lt-accent) 18%, transparent))",
|
||||
backgroundColor: "var(--lt-editor-match-bg)",
|
||||
outline: "1px solid var(--lt-border)",
|
||||
},
|
||||
".cm-gutters": {
|
||||
backgroundColor: "var(--lt-editor-gutter-bg, var(--lt-editor-bg))",
|
||||
color: "var(--lt-editor-gutter-fg, var(--lt-fg-muted))",
|
||||
backgroundColor: "var(--lt-editor-gutter-bg)",
|
||||
color: "var(--lt-editor-gutter-fg)",
|
||||
borderRight: "1px solid var(--lt-border)",
|
||||
},
|
||||
".cm-activeLineGutter": {
|
||||
backgroundColor:
|
||||
"var(--lt-editor-active-line-bg, color-mix(in srgb, var(--lt-fg) 5%, transparent))",
|
||||
backgroundColor: "var(--lt-editor-active-line-bg)",
|
||||
color: "var(--lt-fg)",
|
||||
},
|
||||
".cm-panels": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue