ConstThe test fails if the plugin's own highlight colour gets too close to
the panel background of either palette. Plugins draw with Theme tokens
in Slint and the player switches palettes; a colour the plugin picks
itself does not switch, so a test compares it with each palette's values
(hex strings, #rrggbb).
import assert from "node:assert/strict";
import { THEME_PALETTES } from "@vestra-player/sdk/testing";
const highlight = "#e07000"; // the plugin's own orange
const luminance = (hex: string) => {
const [r, g, b] = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255);
return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!; // rough, without gamma
};
for (const [name, palette] of Object.entries(THEME_PALETTES)) {
const gap = Math.abs(luminance(highlight) - luminance(palette["bg-panel"]!));
assert.ok(gap > 0.3, `${name}: highlight too close to bg-panel`);
}
The colours of the player's palettes, by
Themecolour token (without theTheme.prefix):vestra, the dark default, andvestra-light. The player sets one of them on every view; a plugin reads the colours throughThemein its Slint files and never needs these values. They are here for the documentation (Reference: theme) and for tests that check a design against both palettes.Current values: a later player may adjust them, a token keeps its meaning. The
vestravalues are also the defaults of the SDK's copy of the palette (slint/palette.slint); the player's tests check both palettes against its own.