Official
themes
The stock themes: presets of every colour, type size, corner, density token and background, chosen per light and dark mode and edited in Settings, beside the themes other plugins ship.
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/themes@0.3.1
Permissions in 0.3.1
Files
presets.test.ts2.2 KB
// The presets and the settings that pick them, without the plugin API.
import assert from "node:assert/strict";
import test from "node:test";
import { allPresets, chosen, duplicate, readSettings, STOCK } from "./settings-model.ts";
test("every stock preset is unique and names its mode", () => {
const ids = STOCK.map((preset) => preset.id);
assert.equal(new Set(ids).size, ids.length);
for (const preset of STOCK) assert.equal(preset.tokens.mode, preset.mode);
for (const family of ["divergence", "vscode", "high-contrast", "compact"])
for (const mode of ["light", "dark"]) assert.ok(ids.includes(`${family}-${mode}`), `${family}-${mode}`);
assert.equal(STOCK.find((preset) => preset.id === "divergence-dark")!.name, "Divergence Dark");
assert.equal(STOCK.find((preset) => preset.id === "divergence-light")!.name, "Divergence Light");
});
test("a mode without a choice, or with a gone one, draws the Divergence preset", () => {
assert.equal(chosen({ presets: {}, active: {} }, "dark").id, "divergence-dark");
assert.equal(chosen({ presets: {}, active: { light: "deleted" } }, "light").id, "divergence-light");
assert.equal(chosen({ presets: {}, active: { dark: "vscode-dark" } }, "dark").id, "vscode-dark");
// A preset of the other mode is not drawn for this one.
assert.equal(chosen({ presets: {}, active: { dark: "vscode-light" } }, "dark").id, "divergence-dark");
});
test("a duplicate is a user preset with an id of its own", () => {
const source = STOCK.find((preset) => preset.id === "vscode-dark")!;
const copy = duplicate(source, "VS Code Dark Modern copy", ["vs-code-dark-modern-copy"]);
assert.equal(copy.id, "vs-code-dark-modern-copy-2");
assert.equal(copy.mode, "dark");
assert.equal(copy.stock, undefined);
assert.equal(copy.tokens.name, "VS Code Dark Modern copy");
assert.notEqual(copy.tokens.colors, source.tokens.colors, "the copy's tokens are its own");
});
test("a malformed settings file keeps what is well formed", () => {
const settings = readSettings({
presets: { good: { name: "Mine", mode: "dark", tokens: {} }, bad: { name: 3 } },
active: "nonsense",
});
assert.deepEqual(Object.keys(settings.presets), ["good"]);
assert.deepEqual(settings.active, {});
assert.equal(allPresets(settings).at(-1)?.id, "good");
});
No comments yet.