From 166ca5891994fc99a935cd1409a14201d424531b Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Tue, 23 Jun 2026 17:28:33 +0200 Subject: [PATCH] fix: match root for CSS currentColor and skip unreferenced defs tones --- client/src/utils/__tests__/svg.test.ts | 12 +++++++++++ client/src/utils/svg.ts | 30 +++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts index 29f369599b..ee902f8713 100644 --- a/client/src/utils/__tests__/svg.test.ts +++ b/client/src/utils/__tests__/svg.test.ts @@ -178,6 +178,12 @@ describe('isMonochromeSvg', () => { ''; expect(isMonochromeSvg(svg)).toBe(false); }); + + it('ignores an unreferenced colored template in defs', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); }); describe('currentColor resolved against a fixed color', () => { @@ -240,6 +246,12 @@ describe('isMonochromeSvg', () => { ''; expect(isMonochromeSvg(svg)).toBe(false); }); + + it('preserves a root CSS currentColor fill fixed by the root color', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(false); + }); }); describe('default fills alongside