Skip to content

Commit fef5efd

Browse files
t3dotggclaude
andcommitted
fix(web): t3-light keeps pierre-light's order for every lightness-only pair
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8c6d390 commit fef5efd

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

‎apps/web/src/lib/readableSyntaxTheme.test.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ describe("readableOnLightCode", () => {
2929
});
3030

3131
it("keeps tokens that differed only in lightness apart, in pierre-light's order", () => {
32-
// Comments stay lighter than punctuation; operators stay darker than numbers.
33-
expect(luminance(readableSyntaxColor("#737373"))).toBeGreaterThan(
34-
luminance(readableSyntaxColor("#636363")) + 0.02,
35-
);
36-
expect(luminance(readableSyntaxColor("#1ca1c7"))).toBeGreaterThan(
37-
luminance(readableSyntaxColor("#08c0ef")) + 0.02,
38-
);
32+
// [lighter, darker] in pierre-light: comment/punctuation, operator/number, property/decorator.
33+
for (const [lighter, darker] of [
34+
["#737373", "#636363"],
35+
["#08c0ef", "#1ca1c7"],
36+
["#009fff", "#1a85d4"],
37+
] as const) {
38+
expect(luminance(readableSyntaxColor(lighter))).toBeGreaterThan(
39+
luminance(readableSyntaxColor(darker)) + 0.02,
40+
);
41+
}
3942
});
4043

4144
it("leaves colors that already read unchanged", () => {

‎apps/web/src/lib/readableSyntaxTheme.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export function readableOnLightCode(color: string, minContrast = MIN_CONTRAST):
3636

3737
type ZedTheme = NonNullable<DiffsTheme["zed"]>;
3838

39-
// Colors that differ from a neighbor only in lightness go further, keeping pierre-light's order:
40-
// cyan (operators, pseudo-selectors) stays apart from teal numbers, and gray punctuation and
41-
// parameters stay darker than gray comments.
42-
const FURTHER_COLORS = new Set(["#08c0ef", "#636363"]);
39+
// Pairs that differ only in lightness would merge at one floor. The darker color of each pair
40+
// goes further, keeping pierre-light's order: numbers stay darker than operators, punctuation
41+
// darker than comments, and decorators darker than property names.
42+
const FURTHER_COLORS = new Set(["#1ca1c7", "#636363", "#1a85d4"]);
4343
const FURTHER_MIN_CONTRAST = 6;
4444

4545
/** The t3-light color for a pierre-light syntax color. */

0 commit comments

Comments
 (0)