2 Commits
Author SHA1 Message Date
openhands 304cfb5be7 fix test expectation for accent foreground contrast
CI / check (push) Failing after 24s
CI / release (push) Skipped
CI / deploy (push) Skipped
2026-08-08 21:49:24 +02:00
openhands 02abf8f88c export parseHex, relativeLuminance, softLightSurface for testing 2026-08-08 21:46:40 +02:00
2 changed files with 4 additions and 4 deletions

No files matched your search

+1 -1
View File
@@ -193,7 +193,7 @@ describe("theme-contrast", () => {
expect(result.pairs.length).toBeGreaterThan(0);
expect(result.byName.body).toBeDefined();
expect(result.byName.primary).toBeDefined();
expect(result.byName.accent).toBe("#ffffff");
expect(result.byName.accent).toBe("#000000");
});
it("handles missing keys with defaults", () => {
+3 -3
View File
@@ -28,7 +28,7 @@ export interface AdminPalette {
}
/** Pure / near-white public surfaces → soft admin paper (less eye strain). */
function softLightSurface(
export function softLightSurface(
value: string | undefined,
softDefault: string,
): string {
@@ -262,7 +262,7 @@ export function ensureReadableThemeColors(
return out;
}
function parseHex(value: string): Rgb | null {
export function parseHex(value: string): Rgb | null {
const trimmed = value.trim();
const short = /^#([0-9a-f]{3})$/i.exec(trimmed);
if (short) {
@@ -282,7 +282,7 @@ function parseHex(value: string): Rgb | null {
];
}
function relativeLuminance(rgb: Rgb): number {
export function relativeLuminance(rgb: Rgb): number {
const [red, green, blue] = rgb.map((channel) => {
const value = channel / 255;
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;