style: format code with prettier
Local Build and Deploy / deploy (push) Successful in 49s

This commit is contained in:
openhands committed 2026-07-12 21:07:34 +02:00
1 parent e85e4d74ea
commit 2e4ed76121
378 files changed
+22404 -20686

No files matched your search

+42 -14
View File
@@ -1,5 +1,10 @@
import { describe, expect, it } from "vitest";
import { contrastRatio, deriveAdminPalette, derivePublicForegrounds, readableColor } from "@/lib/theme-contrast";
import {
contrastRatio,
deriveAdminPalette,
derivePublicForegrounds,
readableColor,
} from "@/lib/theme-contrast";
import { PRESETS, THEME_COLOR_KEYS } from "@/lib/theme-presets";
describe("contrastRatio", () => {
@@ -89,7 +94,9 @@ describe("deriveAdminPalette", () => {
it("does not copy hostile public structural colors into admin surfaces", () => {
const admin = deriveAdminPalette({
color_background: "#ff00ff", color_surface: "#00ff00", color_primary: "#ffff00",
color_background: "#ff00ff",
color_surface: "#00ff00",
color_primary: "#ffff00",
});
expect(admin.canvas).not.toBe("#ff00ff");
expect(admin.surface).not.toBe("#00ff00");
@@ -108,9 +115,18 @@ describe("derivePublicForegrounds", () => {
it("covers admin hierarchy and every semantic status", () => {
const required = [
"subtle", "disabled", "sidebar", "input",
"success-text", "success-solid", "warning-text", "warning-solid",
"error-text", "error-solid", "info-text", "info-solid",
"subtle",
"disabled",
"sidebar",
"input",
"success-text",
"success-solid",
"warning-text",
"warning-solid",
"error-text",
"error-solid",
"info-text",
"info-solid",
];
for (const preset of Object.values(PRESETS)) {
for (const palette of [preset.light, preset.dark]) {
@@ -126,16 +142,28 @@ describe("derivePublicForegrounds", () => {
it("repairs hostile white-on-white custom colors", () => {
const result = derivePublicForegrounds({
color_background: "#ffffff", color_surface: "#ffffff", color_dropdown: "#ffffff",
color_navbar: "#ffffff", color_navbar_text: "#ffffff", color_text: "#ffffff",
color_text_muted: "#ffffff", color_primary: "#ffffff", color_accent: "#ffffff",
button_primary_color: "#ffffff", button_text_color: "#ffffff",
button_secondary_color: "#ffffff", button_secondary_text_color: "#ffffff",
button_danger_color: "#ffffff", button_danger_text_color: "#ffffff",
button_outline_color: "#ffffff", button_outline_text_color: "#ffffff",
link_color: "#ffffff", link_hover_color: "#ffffff",
color_background: "#ffffff",
color_surface: "#ffffff",
color_dropdown: "#ffffff",
color_navbar: "#ffffff",
color_navbar_text: "#ffffff",
color_text: "#ffffff",
color_text_muted: "#ffffff",
color_primary: "#ffffff",
color_accent: "#ffffff",
button_primary_color: "#ffffff",
button_text_color: "#ffffff",
button_secondary_color: "#ffffff",
button_secondary_text_color: "#ffffff",
button_danger_color: "#ffffff",
button_danger_text_color: "#ffffff",
button_outline_color: "#ffffff",
button_outline_text_color: "#ffffff",
link_color: "#ffffff",
link_hover_color: "#ffffff",
});
expect(result.pairs.length).toBeGreaterThan(10);
for (const pair of result.pairs) expect(contrastRatio(pair.foreground, pair.background), pair.name).toBeGreaterThanOrEqual(4.5);
for (const pair of result.pairs)
expect(contrastRatio(pair.foreground, pair.background), pair.name).toBeGreaterThanOrEqual(4.5);
});
});