Skip to content

Commit 598d97f

Browse files
flambohclaude
andcommitted
fix(mobile): chips read at 5:1 instead of 4.5:1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent bfcf418 commit 598d97f

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/mobile/src/lib/composerChipPresentation.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const BUILT_IN_THEMES = MOBILE_THEME_IDS.filter((id) => id !== "material-you").f
7070
);
7171

7272
describe("contextChipAccent", () => {
73-
it("draws one color per theme that reads at 4.5:1 in messages, replies and the composer", () => {
73+
it("draws one color per theme that reads at 5:1 in messages, replies and the composer", () => {
7474
for (const { name, theme } of BUILT_IN_THEMES) {
7575
for (const accent of CHIP_ACCENTS) {
7676
const shown = contextChipAccent(accent, theme, theme["--color-md-body"])!;
@@ -79,7 +79,7 @@ describe("contextChipAccent", () => {
7979
expect(
8080
contrastRatio(shown, surface),
8181
`${name}: ${accent} → ${shown} on ${surface}`,
82-
).toBeGreaterThanOrEqual(4.5);
82+
).toBeGreaterThanOrEqual(5);
8383
}
8484
}
8585
}
@@ -97,7 +97,7 @@ describe("contextChipAccent", () => {
9797
expect(
9898
contrastRatio(shown, surface),
9999
`${accent} → ${shown} on ${surface}`,
100-
).toBeGreaterThanOrEqual(4.5);
100+
).toBeGreaterThanOrEqual(5);
101101
}
102102
}
103103
});

‎apps/mobile/src/lib/composerChipPresentation.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const CONTEXT_CHIP_PRESENTATIONS = {
4545
},
4646
} as const satisfies Record<string, ContextChipPresentation>;
4747

48+
const CHIP_CONTRAST = 5;
49+
4850
const readableChipAccents = new Map<string, string>();
4951

5052
/**
@@ -73,7 +75,7 @@ export function contextChipAccent(
7375
const key = [accent, ...surfaces].join();
7476
let readable = readableChipAccents.get(key);
7577
if (readable === undefined) {
76-
readable = themeAccentWithContrast(accent, surfaces);
78+
readable = themeAccentWithContrast(accent, surfaces, CHIP_CONTRAST);
7779
readableChipAccents.set(key, readable);
7880
}
7981
return readable;

0 commit comments

Comments
 (0)