T1: four more themes, theme picker, theme file import, editor font settings

Plum Night, River, Paper and Reed (designed by Amy, approved by Daniel)
join the brand pair. theme.list/current/select/import, a picker with
live preview (view.selectTheme) and "Import Theme…" (view.importTheme);
imported themes are validated and stored in <data_dir>/themes. Editor
font family and line height settings apply live. Docs: docs/themes.md.

Gate: fmt, clippy and the rest pass up to cargo test, where only the
unrelated lutra-terminal PTY test a_full_buffer_stops_the_shell timed
out under load; to be re-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 19:47:58 +01:00
parent 872b5cb258
commit 086bc8a925
26 changed files with 2881 additions and 100 deletions

View file

@ -3,7 +3,8 @@
* Root component: mounts the main window layout with the editor area; the
* slogan shows while no tab is open, and the restore dialog for unsaved
* texts from the recovery journal, the toast stack, the command palette,
* the go-to popup, the settings dialog and the merge dialog. Loads product information from the engine on
* the go-to popup, the settings dialog, the merge dialog and the theme
* picker. Loads product information from the engine on
* mount, starts showing notifications, following the theme (see
* `theme.ts`; a failed theme report raises an error toast) and the global
* keymap with the UI commands (see `commands/store.ts`), and loads the settings so the
@ -22,6 +23,7 @@ import NotificationStack from "./components/notifications/NotificationStack.vue"
import RecoveryDialog from "./components/recovery/RecoveryDialog.vue";
import SettingsDialog from "./components/settings/SettingsDialog.vue";
import MergeDialog from "./components/vcs/merge/MergeDialog.vue";
import ThemePicker from "./components/theme/ThemePicker.vue";
import { useAppStore } from "./stores/app";
import { useAutosaveStore } from "./stores/autosave";
import { useNotificationsStore } from "./stores/notifications";
@ -73,6 +75,7 @@ onUnmounted(() => {
<GotoPopup />
<SettingsDialog />
<MergeDialog />
<ThemePicker />
<NavLayer />
<NotificationStack />
</template>

View file

@ -20,8 +20,8 @@
* - **Navigation (M3.5):** the definition picker and the inline rename field
* are exclusive modals too. So is the branches popup (M4.5), and so are
* "Clone Repository…" and "Manage Remotes…" (M4.10), the merge
* dialog (M4.8) and the stash dialog (M4.9), and the deployment servers
* dialog (G17).
* dialog (M4.8) and the stash dialog (M4.9), the deployment servers
* dialog (G17) and the theme picker (C9 T1).
*/
import { defineStore } from "pinia";
import { ref, watch } from "vue";
@ -41,7 +41,8 @@ export type ModalId =
| "remotes"
| "deployment"
| "merge"
| "stash";
| "stash"
| "themes";
/** Store of the open exclusive modal. */
export const useModalsStore = defineStore("modals", () => {

View file

@ -66,4 +66,6 @@ export const UI_COMMANDS: readonly UiCommandSpec[] = [
{ id: "vcs.nextChange", labelKey: "command.vcs.nextChange", menuPath: "Git/Next Change", defaultShortcut: "Alt+Shift+]" },
{ id: "vcs.previousChange", labelKey: "command.vcs.previousChange", menuPath: "Git/Previous Change", defaultShortcut: "Alt+Shift+[" },
{ id: "view.toggleStructure", labelKey: "command.view.toggleStructure", menuPath: "View/Structure", defaultShortcut: "Mod+2" },
{ id: "view.selectTheme", labelKey: "command.view.selectTheme", menuPath: "View/Select Theme…" },
{ id: "view.importTheme", labelKey: "command.view.importTheme", menuPath: "View/Import Theme…" },
];

View file

@ -50,7 +50,7 @@ export const lutraEditorTheme: Extension = EditorView.theme({
},
".cm-scroller": {
fontFamily: "var(--lt-font-mono)",
lineHeight: "1.5",
lineHeight: "var(--lt-line-height-editor)",
},
".cm-content": {
caretColor: "var(--lt-editor-cursor)",

View file

@ -0,0 +1,285 @@
<script setup lang="ts">
/**
* The theme picker (C9 T1): "Select Theme…" lists the built-in and imported
* themes with a swatch of each (window, editor, accent, keyword and string
* colour) and "Same as system". Up/Down, Home and End move the selection
* and preview the theme live; Enter or a click switches to it; Escape or a
* click outside puts the previous theme back. Also supplies "Import
* Theme…". An exclusive modal (`commands/modals.ts`).
*/
import { Monitor } from "@lucide/vue";
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { useModalsStore } from "../../commands/modals";
import { useCommandsStore } from "../../commands/store";
import { t } from "../../i18n";
import { useThemesStore, type ThemeInfo } from "./themes";
const themes = useThemesStore();
const modals = useModalsStore();
const commands = useCommandsStore();
/** The list element, which holds the focus. */
const list = ref<HTMLElement | null>(null);
/** Element that had the focus before the picker opened. */
let returnFocus: HTMLElement | null = null;
/** Withdraws the UI commands; set while mounted. */
let withdraw: (() => void)[] = [];
/** Swatch tokens, in the order they are drawn. */
const SWATCH = ["--lt-bg", "--lt-editor-bg", "--lt-accent", "--lt-syntax-keyword", "--lt-syntax-string"] as const;
/**
* The swatch colours of a theme.
*
* @param info - the theme.
* @returns CSS colours; empty for "Same as system".
*/
function swatch(info: ThemeInfo): string[] {
const tokens = info.theme?.tokens ?? {};
return SWATCH.map((name) => tokens[name] ?? "transparent");
}
/**
* The second line of a row: dark or light, and whether it was imported.
*
* @param info - the theme.
*/
function kindOf(info: ThemeInfo): string {
if (info.dark === null) {
return t("theme.picker.followsSystem");
}
const mode = info.dark ? t("theme.picker.dark") : t("theme.picker.light");
return info.builtin ? mode : t("theme.picker.imported", { mode });
}
/**
* Keyboard handling of the list.
*
* @param event - the key press.
*/
function onKeydown(event: KeyboardEvent): void {
const count = themes.items.length;
const moves: Record<string, number> = { ArrowDown: 1, ArrowUp: -1, Home: -count, End: count };
const delta = moves[event.key];
if (delta !== undefined) {
themes.move(delta);
scrollSelected();
} else if (event.key === "Enter") {
void themes.choose();
} else if (event.key === "Escape") {
themes.cancel();
} else {
return;
}
event.preventDefault();
event.stopPropagation();
}
/** Keeps the selected row in view. */
function scrollSelected(): void {
void nextTick(() => {
const row = list.value?.querySelector<HTMLElement>(`#lt-theme-${String(themes.selected)}`);
if (row && typeof row.scrollIntoView === "function") {
row.scrollIntoView({ block: "nearest" });
}
});
}
watch(
() => themes.open,
(open) => {
if (open) {
const active = document.activeElement;
returnFocus = active instanceof HTMLElement ? active : null;
modals.opened("themes", () => {
themes.cancel();
});
void nextTick(() => {
list.value?.focus();
scrollSelected();
});
} else {
modals.closed("themes");
returnFocus?.focus();
returnFocus = null;
}
},
);
onMounted(() => {
withdraw = [
commands.provide("view.selectTheme", { run: () => themes.show() }),
commands.provide("view.importTheme", { run: () => themes.importFile() }),
];
});
onUnmounted(() => {
for (const stop of withdraw) {
stop();
}
withdraw = [];
});
</script>
<template>
<div
v-if="themes.open"
class="theme-picker"
data-test="theme-picker"
@mousedown.self.prevent="themes.cancel()"
>
<div
class="theme-picker__dialog"
role="dialog"
aria-modal="true"
:aria-label="t('theme.picker.title')"
>
<p class="theme-picker__title">
{{ t("theme.picker.title") }}
</p>
<ul
ref="list"
class="theme-picker__list"
role="listbox"
tabindex="0"
:aria-label="t('theme.picker.title')"
:aria-activedescendant="`lt-theme-${String(themes.selected)}`"
data-test="theme-picker-list"
@keydown="onKeydown"
>
<li
v-for="(item, index) in themes.items"
:id="`lt-theme-${String(index)}`"
:key="item.id"
class="theme-picker__row"
:class="{ 'theme-picker__row--selected': index === themes.selected }"
role="option"
:aria-selected="index === themes.selected"
:data-id="item.id"
data-test="theme-picker-row"
@mousemove="themes.hover(index)"
@mousedown.prevent
@click="themes.choose(index)"
>
<span
v-if="item.theme"
class="theme-picker__swatch"
aria-hidden="true"
>
<span
v-for="(colour, part) in swatch(item)"
:key="part"
class="theme-picker__chip"
:style="{ background: colour }"
/>
</span>
<Monitor
v-else
class="theme-picker__icon"
:size="14"
aria-hidden="true"
/>
<span class="theme-picker__name">{{ item.name }}</span>
<span class="theme-picker__kind">{{ kindOf(item) }}</span>
<span
v-if="item.id === themes.initialId"
class="theme-picker__current"
>{{ t("theme.picker.current") }}</span>
</li>
</ul>
</div>
</div>
</template>
<style scoped>
.theme-picker {
position: fixed;
inset: 0;
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 12vh;
background: color-mix(in srgb, var(--lt-bg) 40%, transparent);
z-index: 30;
}
.theme-picker__dialog {
width: min(480px, 90vw);
max-height: 60vh;
display: flex;
flex-direction: column;
background: var(--lt-bg);
color: var(--lt-fg);
border: 1px solid var(--lt-border);
border-radius: var(--lt-radius, 4px);
overflow: hidden;
}
.theme-picker__title {
margin: 0;
padding: var(--lt-space-s, 4px) var(--lt-space-m, 8px);
font-weight: 600;
border-bottom: 1px solid var(--lt-border);
}
.theme-picker__list {
margin: 0;
padding: var(--lt-space-s, 4px) 0;
list-style: none;
overflow-y: auto;
outline: none;
}
.theme-picker__row {
display: flex;
align-items: center;
gap: var(--lt-space-m, 8px);
padding: 5px var(--lt-space-m, 8px);
white-space: nowrap;
cursor: default;
}
.theme-picker__row--selected {
background: var(--lt-editor-selection-bg);
}
.theme-picker__swatch {
display: inline-flex;
flex-shrink: 0;
border: 1px solid var(--lt-border);
border-radius: 3px;
overflow: hidden;
}
.theme-picker__chip {
width: 10px;
height: 14px;
}
.theme-picker__icon {
flex-shrink: 0;
width: 52px;
color: var(--lt-fg-muted);
}
.theme-picker__name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.theme-picker__kind,
.theme-picker__current {
flex-shrink: 0;
color: var(--lt-fg-muted);
font-size: var(--lt-font-size-small);
}
.theme-picker__row--selected .theme-picker__kind,
.theme-picker__row--selected .theme-picker__current {
color: var(--lt-fg);
}
</style>

View file

@ -0,0 +1,232 @@
/**
* The theme picker and theme import (C9 T1).
*
* - **Picker:** "Select Theme…" (`view.selectTheme`) lists the built-in
* and imported themes from `theme.list`, plus "Same as system". Moving
* the selection previews the theme live (its tokens go onto `:root`
* through `applyTheme`); Enter or a click switches to it with
* `theme.select`; Escape puts the theme in use back. An exclusive modal
* (`commands/modals.ts`).
* - **Import:** "Import Theme…" (`view.importTheme`) asks for a theme file
* (format: `docs/themes.md`) and runs `theme.import`, which stores the
* theme in Lutra's data directory and switches to it. A broken file
* gives an error toast with the engine's reason.
*/
import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { hasMessage, t } from "../../i18n";
import { pickFile, run } from "../../ipc";
import { useNotificationsStore } from "../../stores/notifications";
import { applyTheme, toResolvedTheme, type ResolvedTheme } from "../../theme";
/** The `appearance.theme` value that follows the OS. */
export const SYSTEM = "system";
/** Most themes read from `theme.list`. */
export const MAX_THEMES = 500;
/** A theme as the picker lists it. */
export interface ThemeInfo {
/** Theme id, or {@link SYSTEM}. */
id: string;
/** Display name: catalog text for built-in themes, the file's name for imported ones. */
name: string;
/** Whether the theme is dark; null for {@link SYSTEM}. */
dark: boolean | null;
/** Whether Lutra ships it. */
builtin: boolean;
/** Its tokens for the preview; null for {@link SYSTEM}. */
theme: ResolvedTheme | null;
}
/**
* Reads one `theme.list` entry from untrusted data.
*
* @param raw - the entry.
* @returns the theme, or null if it is malformed.
*/
export function toThemeInfo(raw: unknown): ThemeInfo | null {
const theme = toResolvedTheme(raw);
if (!theme) {
return null;
}
const { label, name, builtin } = raw as Record<string, unknown>;
const shown =
typeof label === "string" && hasMessage(label)
? t(label)
: typeof name === "string" && name.trim() !== ""
? name.trim()
: theme.id;
return { id: theme.id, name: shown, dark: theme.dark, builtin: builtin === true, theme };
}
/**
* Reads the `theme.list` result and appends "Same as system".
*
* @param raw - the result.
* @returns the themes, or null if the result is not a list.
*/
export function toThemeList(raw: unknown): ThemeInfo[] | null {
if (!Array.isArray(raw)) {
return null;
}
const themes = (raw as unknown[])
.slice(0, MAX_THEMES)
.map(toThemeInfo)
.filter((info): info is ThemeInfo => info !== null);
themes.push({
id: SYSTEM,
name: t("settings.appearance.theme.value.system"),
dark: null,
builtin: true,
theme: null,
});
return themes;
}
/** Store of the theme picker. */
export const useThemesStore = defineStore("themes", () => {
const notifications = useNotificationsStore();
/** Themes in picker order; empty while closed. */
const items = ref<ThemeInfo[]>([]);
/** Index of the selected row. */
const selected = ref(0);
/** Whether the picker is shown. */
const open = ref(false);
/** Id of the theme setting when the picker opened. */
const initialId = ref<string | null>(null);
/** The theme on screen when the picker opened, to restore on Escape. */
let initialTheme: ResolvedTheme | null = null;
/** The selected theme, or null. */
const current = computed(() => items.value[selected.value] ?? null);
/**
* Shows a theme's tokens without switching to it. "Same as system" shows
* the theme in use when the picker opened.
*
* @param info - the theme.
*/
function preview(info: ThemeInfo | null): void {
const theme = info?.theme ?? initialTheme;
if (theme) {
applyTheme(theme);
}
}
/** Opens the picker with the current theme selected. A failed load raises an error toast. */
async function show(): Promise<void> {
const [listed, setting, now] = await Promise.all([
run("theme.list"),
run("settings.get", { keys: ["appearance.theme"] }),
run("theme.current"),
]);
if (!listed.ok) {
notifications.notifyError("theme.list", listed.error);
return;
}
const list = toThemeList(listed.value);
if (!list) {
return;
}
const values = setting.ok ? (setting.value as { values?: Record<string, unknown> } | null)?.values : undefined;
const id = typeof values?.["appearance.theme"] === "string" ? values["appearance.theme"] : null;
initialId.value = id;
initialTheme = now.ok ? toResolvedTheme(now.value) : null;
items.value = list;
selected.value = Math.max(0, list.findIndex((info) => info.id === id));
open.value = true;
}
/**
* Moves the selection and previews the theme there.
*
* @param delta - rows to move; clamped to the list.
*/
function move(delta: number): void {
const count = items.value.length;
if (count === 0) {
return;
}
selected.value = Math.min(count - 1, Math.max(0, selected.value + delta));
preview(current.value);
}
/**
* Selects a row by index and previews it.
*
* @param index - the row.
*/
function hover(index: number): void {
if (index >= 0 && index < items.value.length && index !== selected.value) {
selected.value = index;
preview(current.value);
}
}
/** Closes the picker and puts the theme in use back. */
function cancel(): void {
if (!open.value) {
return;
}
open.value = false;
if (initialTheme) {
applyTheme(initialTheme);
}
}
/**
* Switches to a theme with `theme.select` and closes the picker. A
* failure puts the previous theme back and raises an error toast.
*
* @param index - the row; the selected one when absent.
*/
async function choose(index?: number): Promise<void> {
const info = items.value[index ?? selected.value];
if (!open.value || !info) {
return;
}
open.value = false;
const result = await run("theme.select", { id: info.id });
if (!result.ok) {
if (initialTheme) {
applyTheme(initialTheme);
}
notifications.notifyError("theme.select", result.error);
return;
}
const theme = toResolvedTheme(result.value);
if (theme) {
applyTheme(theme);
}
}
/**
* Asks for a theme file and imports it with `theme.import`. Cancelling
* the file dialog does nothing; success shows an info toast with the
* theme's name; a broken file shows the engine's reason.
*/
async function importFile(): Promise<void> {
const picked = await pickFile(t("theme.import.title"));
if (!picked.ok) {
notifications.notifyError("theme.import", picked.error);
return;
}
if (picked.value === null) {
return;
}
const result = await run("theme.import", { path: picked.value });
if (!result.ok) {
notifications.notifyError("theme.import", result.error);
return;
}
const name = (result.value as { name?: unknown } | null)?.name;
notifications.notify({
level: "info",
messageKey: "theme.import.done",
params: { name: typeof name === "string" ? name : picked.value },
});
}
return { items, selected, open, initialId, current, show, move, hover, cancel, choose, importFile };
});

View file

@ -49,6 +49,8 @@
"command.vcs.showStashes": "Stashes…",
"command.vcs.stash": "Stash Changes…",
"command.vcs.toggleBlame": "Annotate with Git Blame",
"command.view.importTheme": "Import Theme…",
"command.view.selectTheme": "Select Theme…",
"command.view.toggleProjectTree": "Show or Hide Project",
"command.view.toggleStructure": "Show or Hide Structure",
"common.cancel": "Cancel",
@ -359,6 +361,10 @@
"settings.appearance.theme.label": "Theme",
"settings.appearance.theme.value.lutraDark": "Lutra Dark",
"settings.appearance.theme.value.lutraLight": "Lutra Light",
"settings.appearance.theme.value.lutraPaper": "Paper",
"settings.appearance.theme.value.lutraPlumNight": "Plum Night",
"settings.appearance.theme.value.lutraReed": "Reed",
"settings.appearance.theme.value.lutraRiver": "River",
"settings.appearance.theme.value.system": "Same as system",
"settings.dialog.browse": "Browse…",
"settings.dialog.browseLabel": "Choose a file for {name}",
@ -380,10 +386,14 @@
"settings.editor.completion.autoPopup.label": "Show completions while typing",
"settings.editor.completion.delayMs.description": "How long Lutra waits after you stop typing before it asks for completions. 0 asks at once.",
"settings.editor.completion.delayMs.label": "Completion popup delay (ms)",
"settings.editor.fontFamily.description": "Font family of the editor, the terminal and other code text, as a CSS list such as \"JetBrains Mono\", monospace. Empty uses Lutra's default monospace fonts.",
"settings.editor.fontFamily.label": "Editor font",
"settings.editor.fontSize.description": "Size of the text in the editor, in pixels.",
"settings.editor.fontSize.label": "Editor font size",
"settings.editor.hover.delayMs.description": "How long the pointer has to rest on a name before its documentation shows.",
"settings.editor.hover.delayMs.label": "Documentation tooltip delay (ms)",
"settings.editor.lineHeight.description": "Height of each editor line relative to the font size. 150 means one and a half times the font size.",
"settings.editor.lineHeight.label": "Editor line height (%)",
"settings.error.browseFailed": "The file picker could not open: {message}",
"settings.error.int": "Enter a whole number",
"settings.error.intRange": "Enter a whole number from {min} to {max}",
@ -436,8 +446,21 @@
"terminal.tab.numbered": "Local ({n})",
"terminal.tabs.label": "Terminals",
"terminal.toolWindow.title": "Terminal",
"theme.import.done": "Imported the theme {name}.",
"theme.import.title": "Import Theme",
"theme.lutraDark": "Lutra Dark",
"theme.lutraLight": "Lutra Light",
"theme.lutraPaper": "Paper",
"theme.lutraPlumNight": "Plum Night",
"theme.lutraReed": "Reed",
"theme.lutraRiver": "River",
"theme.notification.skipped": "Skipped the theme file {file}: {reason}",
"theme.picker.current": "current",
"theme.picker.dark": "Dark",
"theme.picker.followsSystem": "Follows the light or dark preference of your operating system",
"theme.picker.imported": "{mode}, imported",
"theme.picker.light": "Light",
"theme.picker.title": "Select Theme",
"vcs.branchItem.detached": "Detached HEAD at {hash}. Click for branches.",
"vcs.branchItem.label": "Git branch {branch}. Click for branches.",
"vcs.branches.create": "Create",

View file

@ -8,9 +8,13 @@
* ones.
* - **Errors:** a refused change keeps the error per key until the value
* changes or another change succeeds; the dialog shows it inline.
* - **Effects:** `editor.fontSize` drives `--lt-font-size-editor` (above
* the theme's value, see `setTokenOverride`). `appearance.theme` needs
* nothing here: the engine answers with `themeChanged`.
* - **Effects:** the editor font settings drive theme tokens above the
* theme's value (see `setTokenOverride`), live: `editor.fontSize` →
* `--lt-font-size-editor`, `editor.fontFamily` → `--lt-font-mono` (with
* {@link MONO_FALLBACK} behind it), `editor.lineHeight` →
* `--lt-line-height-editor`. `appearance.theme` needs nothing here: the
* engine answers with `themeChanged`; a change of it reloads the list,
* since an import adds a value (C9 T1).
* - **Text:** labels, descriptions, section names and enum value names are
* catalog keys (`settings.<key>.label`, `settings.<key>.description`,
* `settings.section.<id>`, `settings.<key>.value.<value>`); the engine
@ -38,6 +42,8 @@ export interface SettingDef {
default: SettingValue;
/** Accepted values of an enum; empty otherwise. */
enumValues: string[];
/** Display names of enum values without a catalog key (imported themes), by value. */
valueNames: Record<string, string>;
/** Smallest value of an int, or null. */
min: number | null;
/** Largest value of an int, or null. */
@ -68,6 +74,54 @@ export const FONT_SIZE_KEY = "editor.fontSize";
/** Theme token the editor font size drives. */
export const FONT_SIZE_TOKEN = "--lt-font-size-editor";
/** Key of the editor font family setting. */
export const FONT_FAMILY_KEY = "editor.fontFamily";
/** Theme token the editor font family drives. */
export const FONT_FAMILY_TOKEN = "--lt-font-mono";
/** Fonts behind a chosen family, as `font-mono` in `crates/engine/src/theme.rs`. */
export const MONO_FALLBACK = 'ui-monospace, "Cascadia Code", Menlo, Consolas, monospace';
/** Key of the editor line height setting, in percent of the font size. */
export const LINE_HEIGHT_KEY = "editor.lineHeight";
/** Theme token the editor line height drives. */
export const LINE_HEIGHT_TOKEN = "--lt-line-height-editor";
/** Key of the theme setting. */
export const THEME_KEY = "appearance.theme";
/**
* The token value of an editor font setting, or null for the theme's.
*
* @param key - the setting.
* @param value - its value; unchecked.
* @returns the CSS value, or null when the value is the default or unusable.
*/
export function fontTokenValue(key: string, value: SettingValue | undefined): string | null {
if (key === FONT_SIZE_KEY) {
return typeof value === "number" && Number.isInteger(value) && value > 0 ? `${String(value)}px` : null;
}
if (key === LINE_HEIGHT_KEY) {
return typeof value === "number" && Number.isInteger(value) && value >= 100 && value <= 300
? String(value / 100)
: null;
}
if (key === FONT_FAMILY_KEY) {
const family = typeof value === "string" ? value.trim() : "";
return family === "" || /[;{}<>\\]/.test(family) ? null : `${family}, ${MONO_FALLBACK}`;
}
return null;
}
/** Each editor font setting and the token it drives. */
const FONT_TOKENS: Readonly<Record<string, string>> = {
[FONT_SIZE_KEY]: FONT_SIZE_TOKEN,
[FONT_FAMILY_KEY]: FONT_FAMILY_TOKEN,
[LINE_HEIGHT_KEY]: LINE_HEIGHT_TOKEN,
};
/** Most settings read from `settings.list`; the rest are dropped. */
export const MAX_SETTINGS = 1000;
@ -94,7 +148,7 @@ function toSettingDef(raw: unknown): SettingDef | null {
return null;
}
const entry = raw as Record<string, unknown>;
const { key, type, labelKey, descriptionKey, section, enumValues, min, max } = entry;
const { key, type, labelKey, descriptionKey, section, enumValues, valueNames, min, max } = entry;
if (
typeof key !== "string" ||
typeof labelKey !== "string" ||
@ -110,11 +164,20 @@ function toSettingDef(raw: unknown): SettingDef | null {
if (type === "enum" && values.length === 0) {
return null;
}
const names: Record<string, string> = {};
if (typeof valueNames === "object" && valueNames !== null) {
for (const [value, name] of Object.entries(valueNames as Record<string, unknown>)) {
if (typeof name === "string" && values.includes(value)) {
names[value] = clip(name);
}
}
}
return {
key,
type,
default: toScalar(entry.default),
enumValues: values,
valueNames: names,
min: typeof min === "number" && Number.isFinite(min) ? min : null,
max: typeof max === "number" && Number.isFinite(max) ? max : null,
labelKey,
@ -179,14 +242,15 @@ export function sectionLabel(id: string): string {
/**
* The name of an enum value: `settings.<key>.value.<value>` with the value
* in camel case (`lutra-dark` → `lutraDark`), or the value itself.
* in camel case (`lutra-dark` → `lutraDark`), else the name the engine
* sent (an imported theme), else the value itself.
*
* @param def - the setting.
* @param value - one of its values.
*/
export function valueLabel(def: SettingDef, value: string): string {
const name = value.replace(/[-_.\s]+([A-Za-z0-9])/g, (_m, c: string) => c.toUpperCase());
return textOr(`settings.${def.key}.value.${name}`, value);
return textOr(`settings.${def.key}.value.${name}`, def.valueNames[value] ?? value);
}
/**
@ -259,19 +323,15 @@ export const useSettingsStore = defineStore("settings", () => {
/**
* Applies what a value change means outside the dialog: the editor font
* size token.
* tokens.
*
* @param key - the changed key.
*/
function applyEffect(key: string): void {
if (key !== FONT_SIZE_KEY) {
return;
const token = FONT_TOKENS[key];
if (token !== undefined) {
setTokenOverride(token, fontTokenValue(key, values[key]));
}
const size = values[key];
setTokenOverride(
FONT_SIZE_TOKEN,
typeof size === "number" && Number.isInteger(size) && size > 0 ? `${String(size)}px` : null,
);
}
/**
@ -408,6 +468,10 @@ export const useSettingsStore = defineStore("settings", () => {
for (const key of keys) {
Reflect.deleteProperty(errors, key);
}
if (keys.includes(THEME_KEY)) {
void load();
return;
}
void fetchValues(keys);
}

View file

@ -0,0 +1,178 @@
/**
* Tests of the editor font settings and imported theme names in the
* settings store (C9 T1): `editor.fontFamily`, `editor.fontSize` and
* `editor.lineHeight` drive their tokens live and survive a theme switch;
* imported themes show by name; a change of `appearance.theme` reloads the
* list so a newly imported theme appears. The engine is a fake behind the
* mocked Tauri `invoke` and `listen`.
*/
import { flushPromises } from "@vue/test-utils";
import { createPinia, setActivePinia } from "pinia";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
const invoke = vi.hoisted(() => vi.fn());
const listen = vi.hoisted(() => vi.fn());
vi.mock("@tauri-apps/api/core", () => ({ invoke }));
vi.mock("@tauri-apps/api/event", () => ({ listen }));
import {
FONT_FAMILY_TOKEN,
FONT_SIZE_TOKEN,
LINE_HEIGHT_TOKEN,
MONO_FALLBACK,
fontTokenValue,
toSettingDefs,
useSettingsStore,
valueLabel,
type SettingDef,
} from "../../src/stores/settings";
import { applyTheme, setTokenOverride } from "../../src/theme";
/** The theme setting as `settings.list` describes it, with or without an import. */
function themeDef(imported: boolean): Record<string, unknown> {
return {
key: "appearance.theme",
type: "enum",
default: "system",
enumValues: ["lutra-dark", "lutra-river", ...(imported ? ["dusk"] : []), "system"],
...(imported ? { valueNames: { dusk: "My Dusk", ghost: "Not listed", "lutra-river": 5 } } : {}),
labelKey: "settings.appearance.theme.label",
descriptionKey: "settings.appearance.theme.description",
section: "appearance",
};
}
/** Whether the fake engine already imported `dusk`. */
let imported: boolean;
/** The fake engine's values. */
let values: Record<string, unknown>;
/** Every `engine_execute` command, in order. */
let commands: string[];
/** The engine event callbacks. */
let listeners: ((payload: unknown) => void)[];
const root = document.documentElement;
beforeEach(() => {
setActivePinia(createPinia());
imported = false;
values = {
"appearance.theme": "lutra-dark",
"editor.fontSize": 14,
"editor.fontFamily": "",
"editor.lineHeight": 150,
};
commands = [];
listeners = [];
root.removeAttribute("style");
listen.mockReset();
listen.mockImplementation((_name: string, callback: (event: { payload: unknown }) => void) => {
listeners.push((payload) => {
callback({ payload });
});
return Promise.resolve(() => undefined);
});
invoke.mockReset();
invoke.mockImplementation((cmd: string, args?: { command: string; params: Record<string, unknown> }) => {
if (cmd !== "engine_execute" || !args) {
return Promise.resolve(null);
}
commands.push(args.command);
switch (args.command) {
case "settings.list":
return Promise.resolve([themeDef(imported)]);
case "settings.get": {
const keys = Array.isArray(args.params.keys) ? (args.params.keys as string[]) : Object.keys(values);
return Promise.resolve({ values: Object.fromEntries(keys.map((k) => [k, values[k]])) });
}
default:
return Promise.resolve(null);
}
});
});
afterEach(() => {
useSettingsStore().stop();
for (const token of [FONT_SIZE_TOKEN, FONT_FAMILY_TOKEN, LINE_HEIGHT_TOKEN]) {
setTokenOverride(token, null);
}
});
/**
* Sends an engine event to every subscriber.
*
* @param payload - the event.
*/
async function emit(payload: unknown): Promise<void> {
for (const listener of listeners) {
listener(payload);
}
await flushPromises();
}
describe("fontTokenValue", () => {
it("turns each font setting into its token value", () => {
expect(fontTokenValue("editor.fontSize", 16)).toBe("16px");
expect(fontTokenValue("editor.fontSize", 0)).toBeNull();
expect(fontTokenValue("editor.fontSize", "16")).toBeNull();
expect(fontTokenValue("editor.lineHeight", 150)).toBe("1.5");
expect(fontTokenValue("editor.lineHeight", 120)).toBe("1.2");
expect(fontTokenValue("editor.lineHeight", 99)).toBeNull();
expect(fontTokenValue("editor.lineHeight", 1.5)).toBeNull();
expect(fontTokenValue("editor.fontFamily", "")).toBeNull();
expect(fontTokenValue("editor.fontFamily", " ")).toBeNull();
expect(fontTokenValue("editor.fontFamily", ' "Fira Code" ')).toBe(`"Fira Code", ${MONO_FALLBACK}`);
expect(fontTokenValue("editor.fontFamily", "x; color: red")).toBeNull();
expect(fontTokenValue("editor.fontFamily", "a}b")).toBeNull();
expect(fontTokenValue("editor.other", 3)).toBeNull();
});
});
describe("editor font settings", () => {
it("apply on load and live on settingsChanged, above any theme", async () => {
await useSettingsStore().start();
expect(root.style.getPropertyValue(FONT_SIZE_TOKEN)).toBe("14px");
expect(root.style.getPropertyValue(LINE_HEIGHT_TOKEN)).toBe("1.5");
expect(root.style.getPropertyValue(FONT_FAMILY_TOKEN)).toBe("");
values["editor.fontFamily"] = "Iosevka";
values["editor.lineHeight"] = 180;
await emit({ kind: "settingsChanged", keys: ["editor.fontFamily", "editor.lineHeight"] });
expect(root.style.getPropertyValue(FONT_FAMILY_TOKEN)).toBe(`Iosevka, ${MONO_FALLBACK}`);
expect(root.style.getPropertyValue(LINE_HEIGHT_TOKEN)).toBe("1.8");
applyTheme({
id: "lutra-river",
dark: true,
tokens: { [FONT_FAMILY_TOKEN]: "monospace", [LINE_HEIGHT_TOKEN]: "1.5", "--lt-bg": "#1a2125" },
});
expect(root.style.getPropertyValue(FONT_FAMILY_TOKEN)).toBe(`Iosevka, ${MONO_FALLBACK}`);
expect(root.style.getPropertyValue(LINE_HEIGHT_TOKEN)).toBe("1.8");
values["editor.fontFamily"] = "";
await emit({ kind: "settingsChanged", keys: ["editor.fontFamily"] });
expect(root.style.getPropertyValue(FONT_FAMILY_TOKEN)).toBe("monospace");
});
});
describe("imported themes in the settings", () => {
it("show by the name the engine sends", () => {
const [def] = toSettingDefs([themeDef(true)]) as SettingDef[];
expect(def?.valueNames).toEqual({ dusk: "My Dusk" });
expect(valueLabel(def as SettingDef, "dusk")).toBe("My Dusk");
expect(valueLabel(def as SettingDef, "lutra-river")).toBe("River");
expect(valueLabel(def as SettingDef, "unknown-id")).toBe("unknown-id");
});
it("appear after an import, since a theme change reloads the list", async () => {
const store = useSettingsStore();
await store.start();
expect(store.defs[0]?.enumValues).not.toContain("dusk");
imported = true;
values["appearance.theme"] = "dusk";
await emit({ kind: "settingsChanged", keys: ["appearance.theme"] });
expect(store.defs[0]?.enumValues).toContain("dusk");
expect(store.values["appearance.theme"]).toBe("dusk");
expect(commands.filter((c) => c === "settings.list")).toHaveLength(2);
});
});

View file

@ -0,0 +1,279 @@
/**
* Tests of the theme picker and theme import (C9 T1): "Select Theme…"
* lists the six built-in themes, imported ones and "Same as system" with
* the current one selected; moving previews the tokens live; Escape puts
* the theme back; Enter switches through `theme.select`; "Import Theme…"
* runs `theme.import` with the picked file and reports success or the
* engine's reason. The engine is a fake behind the mocked Tauri `invoke`
* and `listen`, answering from the `themes.json` snapshot.
*/
import { flushPromises, mount, type VueWrapper } from "@vue/test-utils";
import { createPinia, setActivePinia, type Pinia } from "pinia";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import themes from "./themes.json";
const invoke = vi.hoisted(() => vi.fn());
vi.mock("@tauri-apps/api/core", () => ({ invoke }));
vi.mock("@tauri-apps/api/event", () => ({ listen: () => Promise.resolve(() => undefined) }));
import { useCommandsStore } from "../../src/commands/store";
import { useModalsStore } from "../../src/commands/modals";
import ThemePicker from "../../src/components/theme/ThemePicker.vue";
import { SYSTEM, toThemeInfo, toThemeList, useThemesStore } from "../../src/components/theme/themes";
import { useNotificationsStore } from "../../src/stores/notifications";
/** An imported theme as `theme.list` lists it. */
const IMPORTED = {
id: "dusk",
label: null,
name: "My Dusk",
dark: true,
builtin: false,
tokens: { ...(themes[3]?.tokens ?? {}), "--lt-bg": "#102030" },
};
/** The fake engine's `appearance.theme`. */
let setting: string;
/** Every `engine_execute` call, in order. */
let calls: { command: string; params: Record<string, unknown> }[];
/** What `pick_file` returns. */
let picked: string | null;
/** Commands that fail, with their message. */
let failing: Map<string, string>;
/** Pinia of the current test. */
let pinia: Pinia;
/** Mounted components, unmounted after each test. */
let mounted: VueWrapper[];
const root = document.documentElement;
/**
* A theme of the fake engine by id.
*
* @param id - the theme id.
*/
function themeOf(id: string): { id: string; dark: boolean; tokens: Record<string, string> } {
if (id === IMPORTED.id) {
return IMPORTED;
}
const found = themes.find((t) => t.id === id) ?? themes[0];
if (!found) {
throw new Error("no themes");
}
return found;
}
/**
* The fake engine's answer to a command.
*
* @param command - the command id.
* @param params - its params.
*/
function answer(command: string, params: Record<string, unknown>): unknown {
switch (command) {
case "theme.list":
return [
...themes.map((t) => ({ id: t.id, label: t.labelKey, name: null, dark: t.dark, builtin: true, tokens: t.tokens })),
IMPORTED,
];
case "settings.get":
return { values: { "appearance.theme": setting } };
case "theme.current":
return themeOf(setting === SYSTEM ? "lutra-dark" : setting);
case "theme.select":
setting = params.id as string;
return themeOf(setting === SYSTEM ? "lutra-dark" : setting);
case "theme.import":
return { id: "dusk", name: "My Dusk", dark: true, replaced: false };
default:
return null;
}
}
/** Mounts the picker and starts the command store. */
async function mountPicker(): Promise<VueWrapper> {
const wrapper = mount(ThemePicker, { attachTo: document.body, global: { plugins: [pinia] } });
mounted.push(wrapper);
await useCommandsStore(pinia).start();
await flushPromises();
return wrapper;
}
/**
* Presses a key on the picker's list.
*
* @param wrapper - the picker.
* @param key - the key.
*/
async function press(wrapper: VueWrapper, key: string): Promise<void> {
await wrapper.find("[data-test=theme-picker-list]").trigger("keydown", { key });
await flushPromises();
}
/**
* The ids of the listed themes.
*
* @param wrapper - the picker.
*/
function ids(wrapper: VueWrapper): string[] {
return wrapper.findAll("[data-test=theme-picker-row]").map((row) => row.attributes("data-id") ?? "");
}
beforeEach(() => {
pinia = createPinia();
setActivePinia(pinia);
setting = "lutra-river";
calls = [];
picked = null;
failing = new Map();
mounted = [];
root.removeAttribute("style");
invoke.mockReset();
invoke.mockImplementation((cmd: string, args?: { command: string; params: Record<string, unknown> }) => {
if (cmd === "engine_list_commands") {
return Promise.resolve([]);
}
if (cmd === "pick_file") {
return Promise.resolve(picked);
}
if (cmd === "engine_execute" && args) {
calls.push({ command: args.command, params: args.params });
const message = failing.get(args.command);
if (message !== undefined) {
return Promise.reject(Object.assign(new Error(message), { code: "failed", message }));
}
return Promise.resolve(answer(args.command, args.params));
}
return Promise.resolve(null);
});
});
afterEach(() => {
useCommandsStore(pinia).stop();
for (const wrapper of mounted) {
wrapper.unmount();
}
});
describe("theme list helpers", () => {
it("reads theme.list defensively and names themes", () => {
expect(toThemeList("nope")).toBeNull();
const list = toThemeList([null, { id: 1 }, ...themes.map((t) => ({ ...t, label: t.labelKey })), IMPORTED]);
expect(list?.map((t) => t.name)).toEqual([
"Lutra Dark",
"Lutra Light",
"Plum Night",
"River",
"Paper",
"Reed",
"My Dusk",
"Same as system",
]);
expect(list?.at(-1)).toMatchObject({ id: SYSTEM, dark: null, theme: null });
expect(toThemeInfo({ id: "x", dark: false, name: " " })?.name).toBe("x");
});
});
describe("theme picker", () => {
it("opens from view.selectTheme with every theme and the current one selected", async () => {
const wrapper = await mountPicker();
await useCommandsStore(pinia).execute("view.selectTheme");
await flushPromises();
expect(ids(wrapper)).toEqual([
"lutra-dark",
"lutra-light",
"lutra-plum-night",
"lutra-river",
"lutra-paper",
"lutra-reed",
"dusk",
SYSTEM,
]);
const selected = wrapper.find(".theme-picker__row--selected");
expect(selected.attributes("data-id")).toBe("lutra-river");
expect(selected.text()).toContain("River");
expect(selected.text()).toContain("current");
expect(wrapper.find('[data-id="dusk"]').text()).toContain("Dark, imported");
expect(useModalsStore(pinia).current).toBe("themes");
expect(document.activeElement?.getAttribute("data-test")).toBe("theme-picker-list");
});
it("previews while moving and puts the theme back on Escape", async () => {
const wrapper = await mountPicker();
await useThemesStore(pinia).show();
await flushPromises();
await press(wrapper, "ArrowDown");
expect(root.style.getPropertyValue("--lt-bg")).toBe(themeOf("lutra-paper").tokens["--lt-bg"]);
expect(root.style.colorScheme).toBe("light");
await press(wrapper, "End");
expect(root.style.getPropertyValue("--lt-bg")).toBe(themeOf("lutra-river").tokens["--lt-bg"]);
await press(wrapper, "ArrowUp");
expect(root.style.getPropertyValue("--lt-bg")).toBe("#102030");
await press(wrapper, "Escape");
expect(wrapper.find("[data-test=theme-picker]").exists()).toBe(false);
expect(root.style.getPropertyValue("--lt-bg")).toBe(themeOf("lutra-river").tokens["--lt-bg"]);
expect(calls.some((c) => c.command === "theme.select")).toBe(false);
expect(useModalsStore(pinia).current).toBeNull();
});
it("switches with Enter and with a click", async () => {
const wrapper = await mountPicker();
await useThemesStore(pinia).show();
await flushPromises();
await press(wrapper, "Home");
await press(wrapper, "ArrowDown");
await press(wrapper, "ArrowDown");
await press(wrapper, "Enter");
expect(calls.filter((c) => c.command === "theme.select").map((c) => c.params)).toEqual([{ id: "lutra-plum-night" }]);
expect(wrapper.find("[data-test=theme-picker]").exists()).toBe(false);
expect(root.dataset.theme).toBe("lutra-plum-night");
await useThemesStore(pinia).show();
await flushPromises();
await wrapper.find('[data-id="lutra-reed"]').trigger("click");
await flushPromises();
expect(setting).toBe("lutra-reed");
expect(root.style.getPropertyValue("--lt-bg")).toBe(themeOf("lutra-reed").tokens["--lt-bg"]);
});
it("puts the theme back and raises a toast when switching fails", async () => {
const wrapper = await mountPicker();
failing.set("theme.select", "settings cannot be saved");
await useThemesStore(pinia).show();
await flushPromises();
await press(wrapper, "ArrowDown");
await press(wrapper, "Enter");
expect(root.style.getPropertyValue("--lt-bg")).toBe(themeOf("lutra-river").tokens["--lt-bg"]);
expect(useNotificationsStore(pinia).toasts.at(-1)?.text).toContain("settings cannot be saved");
});
});
describe("theme import", () => {
it("imports the picked file and confirms it", async () => {
await mountPicker();
picked = "C:/themes/dusk.json";
await useCommandsStore(pinia).execute("view.importTheme");
await flushPromises();
expect(calls.find((c) => c.command === "theme.import")?.params).toEqual({ path: "C:/themes/dusk.json" });
expect(useNotificationsStore(pinia).toasts.at(-1)).toMatchObject({ level: "info", text: "Imported the theme My Dusk." });
});
it("does nothing when the file dialog is cancelled", async () => {
await mountPicker();
await useThemesStore(pinia).importFile();
await flushPromises();
expect(calls.filter((c) => c.command.startsWith("theme."))).toEqual([]);
expect(useNotificationsStore(pinia).toasts).toEqual([]);
});
it("shows the reason of a broken file", async () => {
await mountPicker();
picked = "C:/themes/bad.json";
failing.set("theme.import", 'cannot import the theme C:/themes/bad.json: 59 tokens are missing: bg, editor-bg');
await useThemesStore(pinia).importFile();
await flushPromises();
const toast = useNotificationsStore(pinia).toasts.at(-1);
expect(toast?.level).toBe("error");
expect(toast?.text).toContain("59 tokens are missing");
});
});

View file

@ -106,21 +106,24 @@ const KIND_PAIRS: [string, string, number][] = [...new Set(Object.values(KIND_CO
/** ANSI colour names, as in `TERMINAL_TOKENS` in `theme.rs`. */
const ANSI = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"] as const;
/** ANSI tokens that may blend into the background, per theme id. */
const TERMINAL_EXEMPT: Record<string, readonly string[]> = {
"lutra-dark": ["terminal-ansi-black"],
"lutra-light": ["terminal-ansi-white", "terminal-ansi-bright-white"],
};
/**
* ANSI tokens that may blend into the background: black in dark themes,
* white and bright white in light ones.
*/
const TERMINAL_EXEMPT = {
dark: ["terminal-ansi-black"],
light: ["terminal-ansi-white", "terminal-ansi-bright-white"],
} as const;
/**
* The terminal's pairs for one theme: text and selection, the cursor, and
* every ANSI colour (normal and bright) that is not exempt.
*
* @param id - the theme id.
* @param dark - whether the theme is dark.
* @returns foreground token, background token and minimum ratio.
*/
function terminalPairs(id: string): [string, string, number][] {
const exempt = TERMINAL_EXEMPT[id] ?? [];
function terminalPairs(dark: boolean): [string, string, number][] {
const exempt: readonly string[] = TERMINAL_EXEMPT[dark ? "dark" : "light"];
const ansi = ANSI.flatMap((name) => [`terminal-ansi-${name}`, `terminal-ansi-bright-${name}`]).filter(
(name) => !exempt.includes(name),
);
@ -162,6 +165,27 @@ export function contrast(a: string, b: string): number {
return (hi + 0.05) / (lo + 0.05);
}
describe("built-in themes", () => {
it("are the brand pair and the four C9 themes, two of each kind added", () => {
expect(themes.map((theme) => theme.id)).toEqual([
"lutra-dark",
"lutra-light",
"lutra-plum-night",
"lutra-river",
"lutra-paper",
"lutra-reed",
]);
expect(themes.filter((theme) => theme.dark)).toHaveLength(3);
});
it("all define the same tokens", () => {
const names = (tokens: Record<string, string>): string[] => Object.keys(tokens).sort();
for (const theme of themes) {
expect(names(theme.tokens)).toEqual(names(themes[0]?.tokens ?? {}));
}
});
});
describe("contrast helper", () => {
it("matches the WCAG extremes", () => {
expect(contrast("#000000", "#ffffff")).toBeCloseTo(21, 5);
@ -203,7 +227,7 @@ describe.each(themes)("theme $id", (theme) => {
expect(defined).toHaveLength(ANSI.length * 2);
});
it.each([...PAIRS, ...SYNTAX_PAIRS, ...STATUS_PAIRS, ...TAB_STATUS_PAIRS, ...KIND_PAIRS, ...terminalPairs(theme.id)])("%s on %s reaches %d:1", (fg, bg, min) => {
it.each([...PAIRS, ...SYNTAX_PAIRS, ...STATUS_PAIRS, ...TAB_STATUS_PAIRS, ...KIND_PAIRS, ...terminalPairs(theme.dark)])("%s on %s reaches %d:1", (fg, bg, min) => {
expect(contrast(token(fg), token(bg))).toBeGreaterThanOrEqual(min);
});
});

View file

@ -26,6 +26,7 @@
"--lt-font-size-small": "12px",
"--lt-font-size-ui": "13px",
"--lt-font-ui": "system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, sans-serif",
"--lt-line-height-editor": "1.5",
"--lt-notice-bg": "#382632",
"--lt-statusbar-bg": "#231f23",
"--lt-statusbar-fg": "#bdb3b8",
@ -97,6 +98,7 @@
"--lt-font-size-small": "12px",
"--lt-font-size-ui": "13px",
"--lt-font-ui": "system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, sans-serif",
"--lt-line-height-editor": "1.5",
"--lt-notice-bg": "#eedcdc",
"--lt-statusbar-bg": "#ebe5d5",
"--lt-statusbar-fg": "#554c50",
@ -140,5 +142,293 @@
"--lt-vcs-modified": "#2f5aa8",
"--lt-vcs-untracked": "#93560c"
}
},
{
"dark": true,
"id": "lutra-plum-night",
"labelKey": "theme.lutraPlumNight",
"tokens": {
"--lt-accent": "#e6c27f",
"--lt-bg": "#241a22",
"--lt-border": "#3d2c38",
"--lt-diag-error": "#f48a78",
"--lt-diag-hint": "#a8969f",
"--lt-diag-info": "#9db4ea",
"--lt-diag-warning": "#e8b85a",
"--lt-editor-active-line-bg": "#291e27",
"--lt-editor-bg": "#1c1419",
"--lt-editor-cursor": "#e6c27f",
"--lt-editor-gutter-bg": "#1c1419",
"--lt-editor-gutter-fg": "#a8969f",
"--lt-editor-match-bg": "#43303a",
"--lt-editor-selection-bg": "#56334a",
"--lt-error": "#f48a78",
"--lt-fg": "#f0e6dc",
"--lt-fg-muted": "#a8969f",
"--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-line-height-editor": "1.5",
"--lt-notice-bg": "#3e2836",
"--lt-statusbar-bg": "#2a1e27",
"--lt-statusbar-fg": "#c4b3bb",
"--lt-syntax-attribute": "#d4b98a",
"--lt-syntax-comment": "#9c8a94",
"--lt-syntax-constant": "#c5a8ec",
"--lt-syntax-function": "#ebca7d",
"--lt-syntax-keyword": "#ec92bd",
"--lt-syntax-number": "#efa985",
"--lt-syntax-operator": "#c4b3bb",
"--lt-syntax-string": "#b6c98a",
"--lt-syntax-tag": "#e8907a",
"--lt-syntax-type": "#8cc0cc",
"--lt-syntax-variable": "#e3cdbb",
"--lt-tab-active-bg": "#1c1419",
"--lt-tab-modified": "#e6c27f",
"--lt-terminal-ansi-black": "#33262f",
"--lt-terminal-ansi-blue": "#98aee6",
"--lt-terminal-ansi-bright-black": "#a8969f",
"--lt-terminal-ansi-bright-blue": "#b8c6f2",
"--lt-terminal-ansi-bright-cyan": "#acd6de",
"--lt-terminal-ansi-bright-green": "#cbdca6",
"--lt-terminal-ansi-bright-magenta": "#f4b0cf",
"--lt-terminal-ansi-bright-red": "#f8a596",
"--lt-terminal-ansi-bright-white": "#faf3ea",
"--lt-terminal-ansi-bright-yellow": "#f4dc9a",
"--lt-terminal-ansi-cyan": "#8cc0cc",
"--lt-terminal-ansi-green": "#b6c98a",
"--lt-terminal-ansi-magenta": "#ec92bd",
"--lt-terminal-ansi-red": "#f28474",
"--lt-terminal-ansi-white": "#d9cdc6",
"--lt-terminal-ansi-yellow": "#ebca7d",
"--lt-terminal-bg": "#1c1419",
"--lt-terminal-cursor": "#e6c27f",
"--lt-terminal-fg": "#f0e6dc",
"--lt-terminal-selection-bg": "#56334a",
"--lt-vcs-added": "#a6c784",
"--lt-vcs-conflicted": "#f6788e",
"--lt-vcs-deleted": "#dc9890",
"--lt-vcs-ignored": "#9e8e97",
"--lt-vcs-modified": "#9db4ea",
"--lt-vcs-untracked": "#e8aa6c"
}
},
{
"dark": true,
"id": "lutra-river",
"labelKey": "theme.lutraRiver",
"tokens": {
"--lt-accent": "#6fc6b8",
"--lt-bg": "#1a2125",
"--lt-border": "#2c373d",
"--lt-diag-error": "#f08a7a",
"--lt-diag-hint": "#8e9ca3",
"--lt-diag-info": "#8fb6ec",
"--lt-diag-warning": "#e2b65c",
"--lt-editor-active-line-bg": "#1b2327",
"--lt-editor-bg": "#151b1e",
"--lt-editor-cursor": "#6fc6b8",
"--lt-editor-gutter-bg": "#151b1e",
"--lt-editor-gutter-fg": "#8e9ca3",
"--lt-editor-match-bg": "#24393b",
"--lt-editor-selection-bg": "#28434a",
"--lt-error": "#f08a7a",
"--lt-fg": "#e2e8e6",
"--lt-fg-muted": "#8e9ca3",
"--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-line-height-editor": "1.5",
"--lt-notice-bg": "#223a3c",
"--lt-statusbar-bg": "#1e272b",
"--lt-statusbar-fg": "#adbbc0",
"--lt-syntax-attribute": "#c9bd86",
"--lt-syntax-comment": "#87959c",
"--lt-syntax-constant": "#b4aaea",
"--lt-syntax-function": "#e4cb7c",
"--lt-syntax-keyword": "#e392b6",
"--lt-syntax-number": "#e8ae86",
"--lt-syntax-operator": "#adbbc0",
"--lt-syntax-string": "#9fcb94",
"--lt-syntax-tag": "#e6957c",
"--lt-syntax-type": "#74c3d1",
"--lt-syntax-variable": "#d2dcd9",
"--lt-tab-active-bg": "#151b1e",
"--lt-tab-modified": "#6fc6b8",
"--lt-terminal-ansi-black": "#263035",
"--lt-terminal-ansi-blue": "#8cb0e8",
"--lt-terminal-ansi-bright-black": "#8e9ca3",
"--lt-terminal-ansi-bright-blue": "#afc6f2",
"--lt-terminal-ansi-bright-cyan": "#a6dbe3",
"--lt-terminal-ansi-bright-green": "#bfdeb2",
"--lt-terminal-ansi-bright-magenta": "#f0b0cd",
"--lt-terminal-ansi-bright-red": "#f6a597",
"--lt-terminal-ansi-bright-white": "#f3f6f5",
"--lt-terminal-ansi-bright-yellow": "#f0dc9c",
"--lt-terminal-ansi-cyan": "#74c3d1",
"--lt-terminal-ansi-green": "#9fcb94",
"--lt-terminal-ansi-magenta": "#e392b6",
"--lt-terminal-ansi-red": "#ee8172",
"--lt-terminal-ansi-white": "#c6d0cd",
"--lt-terminal-ansi-yellow": "#e4cb7c",
"--lt-terminal-bg": "#151b1e",
"--lt-terminal-cursor": "#6fc6b8",
"--lt-terminal-fg": "#e2e8e6",
"--lt-terminal-selection-bg": "#28434a",
"--lt-vcs-added": "#93c98a",
"--lt-vcs-conflicted": "#f27a90",
"--lt-vcs-deleted": "#d69a92",
"--lt-vcs-ignored": "#86939a",
"--lt-vcs-modified": "#8fb6ec",
"--lt-vcs-untracked": "#e3aa6a"
}
},
{
"dark": false,
"id": "lutra-paper",
"labelKey": "theme.lutraPaper",
"tokens": {
"--lt-accent": "#83224b",
"--lt-bg": "#f6f5f1",
"--lt-border": "#e2dfd7",
"--lt-diag-error": "#ad3524",
"--lt-diag-hint": "#625b5f",
"--lt-diag-info": "#2d58a6",
"--lt-diag-warning": "#7f5000",
"--lt-editor-active-line-bg": "#f7f5f0",
"--lt-editor-bg": "#fefdfb",
"--lt-editor-cursor": "#83224b",
"--lt-editor-gutter-bg": "#fefdfb",
"--lt-editor-gutter-fg": "#625b5f",
"--lt-editor-match-bg": "#f4e3ea",
"--lt-editor-selection-bg": "#efd9e3",
"--lt-error": "#ad3524",
"--lt-fg": "#221d20",
"--lt-fg-muted": "#625b5f",
"--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-line-height-editor": "1.5",
"--lt-notice-bg": "#f3e2e8",
"--lt-statusbar-bg": "#eeece6",
"--lt-statusbar-fg": "#4f474b",
"--lt-syntax-attribute": "#645a17",
"--lt-syntax-comment": "#686064",
"--lt-syntax-constant": "#5a44a0",
"--lt-syntax-function": "#745306",
"--lt-syntax-keyword": "#8e2856",
"--lt-syntax-number": "#984216",
"--lt-syntax-operator": "#4f474b",
"--lt-syntax-string": "#46661f",
"--lt-syntax-tag": "#a23f27",
"--lt-syntax-type": "#1f6476",
"--lt-syntax-variable": "#5c3f4e",
"--lt-tab-active-bg": "#fefdfb",
"--lt-tab-modified": "#83224b",
"--lt-terminal-ansi-black": "#221d20",
"--lt-terminal-ansi-blue": "#2c52a2",
"--lt-terminal-ansi-bright-black": "#625b5f",
"--lt-terminal-ansi-bright-blue": "#213c7c",
"--lt-terminal-ansi-bright-cyan": "#174e5c",
"--lt-terminal-ansi-bright-green": "#365015",
"--lt-terminal-ansi-bright-magenta": "#6a1a40",
"--lt-terminal-ansi-bright-red": "#8a2717",
"--lt-terminal-ansi-bright-white": "#f6f5f1",
"--lt-terminal-ansi-bright-yellow": "#5a4003",
"--lt-terminal-ansi-cyan": "#1f6476",
"--lt-terminal-ansi-green": "#46661f",
"--lt-terminal-ansi-magenta": "#8e2856",
"--lt-terminal-ansi-red": "#ad3524",
"--lt-terminal-ansi-white": "#e2dfd7",
"--lt-terminal-ansi-yellow": "#745306",
"--lt-terminal-bg": "#fefdfb",
"--lt-terminal-cursor": "#83224b",
"--lt-terminal-fg": "#221d20",
"--lt-terminal-selection-bg": "#efd9e3",
"--lt-vcs-added": "#38701f",
"--lt-vcs-conflicted": "#a81c40",
"--lt-vcs-deleted": "#9e4236",
"--lt-vcs-ignored": "#6d6569",
"--lt-vcs-modified": "#2d58a6",
"--lt-vcs-untracked": "#8c520a"
}
},
{
"dark": false,
"id": "lutra-reed",
"labelKey": "theme.lutraReed",
"tokens": {
"--lt-accent": "#3c6447",
"--lt-bg": "#e9e7d8",
"--lt-border": "#d2cfbb",
"--lt-diag-error": "#a63424",
"--lt-diag-hint": "#5b5a4f",
"--lt-diag-info": "#2b549c",
"--lt-diag-warning": "#784c00",
"--lt-editor-active-line-bg": "#eceadd",
"--lt-editor-bg": "#f3f2e8",
"--lt-editor-cursor": "#3c6447",
"--lt-editor-gutter-bg": "#f3f2e8",
"--lt-editor-gutter-fg": "#5b5a4f",
"--lt-editor-match-bg": "#e2e6d2",
"--lt-editor-selection-bg": "#d7e0cc",
"--lt-error": "#a63424",
"--lt-fg": "#25261f",
"--lt-fg-muted": "#5b5a4f",
"--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-line-height-editor": "1.5",
"--lt-notice-bg": "#dde3cf",
"--lt-statusbar-bg": "#e1dfce",
"--lt-statusbar-fg": "#4a4a40",
"--lt-syntax-attribute": "#5f5718",
"--lt-syntax-comment": "#625f55",
"--lt-syntax-constant": "#57439a",
"--lt-syntax-function": "#6e5006",
"--lt-syntax-keyword": "#8c2a5a",
"--lt-syntax-number": "#913f17",
"--lt-syntax-operator": "#4a4a40",
"--lt-syntax-string": "#3d6020",
"--lt-syntax-tag": "#9a3c26",
"--lt-syntax-type": "#1d5f6e",
"--lt-syntax-variable": "#6c4433",
"--lt-tab-active-bg": "#f3f2e8",
"--lt-tab-modified": "#3c6447",
"--lt-terminal-ansi-black": "#25261f",
"--lt-terminal-ansi-blue": "#2a4f98",
"--lt-terminal-ansi-bright-black": "#5b5a4f",
"--lt-terminal-ansi-bright-blue": "#203a76",
"--lt-terminal-ansi-bright-cyan": "#164a56",
"--lt-terminal-ansi-bright-green": "#304b14",
"--lt-terminal-ansi-bright-magenta": "#6a1c42",
"--lt-terminal-ansi-bright-red": "#842617",
"--lt-terminal-ansi-bright-white": "#e9e7d8",
"--lt-terminal-ansi-bright-yellow": "#553d03",
"--lt-terminal-ansi-cyan": "#1d5f6e",
"--lt-terminal-ansi-green": "#3d6020",
"--lt-terminal-ansi-magenta": "#8c2a5a",
"--lt-terminal-ansi-red": "#a63424",
"--lt-terminal-ansi-white": "#d2cfbb",
"--lt-terminal-ansi-yellow": "#6e5006",
"--lt-terminal-bg": "#f3f2e8",
"--lt-terminal-cursor": "#3c6447",
"--lt-terminal-fg": "#25261f",
"--lt-terminal-selection-bg": "#d7e0cc",
"--lt-vcs-added": "#356a1e",
"--lt-vcs-conflicted": "#a11c3e",
"--lt-vcs-deleted": "#973f33",
"--lt-vcs-ignored": "#615e54",
"--lt-vcs-modified": "#2b549c",
"--lt-vcs-untracked": "#844d0a"
}
}
]