mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 00:18:27 +00:00
* feat(studio): the code editor follows studio's light and dark theme Replaces One Dark with a Studio editor theme whose colours are theme.css variables: eight syntax role tokens (One Light and One Dark hues held at 4.5:1), editor surfaces from Studio's roles, all measured by the contrast ratchet. * test(studio): the code editor theme takes every colour from a theme.css token * fix(studio): code stays at 4.5:1 when a selection or search match sits on the active line Syntax tokens are tuned for the selection over the active line, which the ratchet now measures; matches are outlined rather than stacking another wash; the search panel's pressed button and special characters follow the theme; unused tooltip rules go. * fix(studio): code matches carry no background, and types read apart from constants Search and selection matches are outlined only, so CodeMirror's lime match wash and stacked washes are gone; type and constant tokens split by hue in both themes. * fix(studio): the current search match reads apart by width, not colour alone A 2px accent outline on the current match and a muted 1px outline on other copies of the selected word.
21 lines
886 B
TypeScript
21 lines
886 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const read = (file: string) => readFileSync(new URL(file, import.meta.url), "utf8");
|
|
const source = read("./studioCodeTheme.ts");
|
|
const themeCss = read("../../styles/theme.css");
|
|
|
|
describe("the code editor theme", () => {
|
|
it("takes every colour from a token theme.css declares", () => {
|
|
const used = [...source.matchAll(/var\((--color-[\w-]+)\)/g)].map((match) => match[1]!);
|
|
expect(used.length).toBeGreaterThan(20);
|
|
for (const token of new Set(used)) expect(themeCss, token).toContain(`${token}:`);
|
|
});
|
|
|
|
it("paints no literal colour of its own", () => {
|
|
expect(source).not.toMatch(
|
|
/#[\da-f]{3,8}\b|\b(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\(|"(white|black|red|orange|yellow|green|blue|purple|pink|gray|grey|silver|lime|cyan|magenta)"/i,
|
|
);
|
|
});
|
|
});
|