Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(shared): PASS and FAIL badges stay readable in dark command output #24042

MergedWesleySmits(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/24042/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 7 additions and 1 deletion.

x
0 of 2 viewed, 2 left
6 additions and 0 deletionspackages/shared/src/terminalOutput.test.tsModified
View file
@@ -264,4 +264,10 @@
expect(spans.at(-1)?.style).toBeNull();
expect(spans.map((span) => span.text).join("")).toBe("xy".repeat(50));
});
+​
+ it("gives badge text at least 3:1 on the dark palette's coloured backgrounds", () => {
+ const text = normalizeTerminalOutput("\u001b[42m PASS \u001b[1;37;41m FAIL ").text;
+ const spans = terminalOutputSpans(text, TERMINAL_PALETTES.dark);
+ expect(spans.map((span) => span.style?.color)).toEqual(["#1f2328", "#1f2328"]);
+ });
});
1 addition and 1 deletionpackages/shared/src/terminalOutput.tsModified
View file
@@ -831,7 +831,7 @@
background !== undefined &&
(foreground === undefined || contrastRatio(foreground, background) < 3)
) {
- color = luminance(background) > 0.35 ? "#1f2328" : "#ffffff";
+ color = luminance(background) > 0.3 ? "#1f2328" : "#ffffff";
const textDecorationLine = attributes.underline