From 840b06695f8a7e2f130aa0e9d10aceb98102d9df Mon Sep 17 00:00:00 2001
From: Marco Beretta <81851188+berry-13@users.noreply.github.com>
Date: Tue, 23 Jun 2026 16:00:58 +0200
Subject: [PATCH] fix: ignore display:none shapes and stop counting CSS color
as paint
---
client/src/utils/__tests__/svg.test.ts | 24 +++++++++
client/src/utils/svg.ts | 71 ++++++++++++++++++--------
2 files changed, 75 insertions(+), 20 deletions(-)
diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts
index b65f347cfd..0eb83997bc 100644
--- a/client/src/utils/__tests__/svg.test.ts
+++ b/client/src/utils/__tests__/svg.test.ts
@@ -210,6 +210,18 @@ describe('isMonochromeSvg', () => {
'';
expect(isMonochromeSvg(svg)).toBe(true);
});
+
+ it('does not count an unused CSS color declaration as a tone', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('resolves CSS currentColor against a CSS color declaration', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(false);
+ });
});
describe('default fills alongside ';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
it('rejects a full-size percentage background rect', () => {
const svg =
'';
diff --git a/client/src/utils/svg.ts b/client/src/utils/svg.ts
index a1ed1edbcb..e8e658da3f 100644
--- a/client/src/utils/svg.ts
+++ b/client/src/utils/svg.ts
@@ -66,6 +66,8 @@ const PAINT_OPACITY = new Map([
/** Declarations resolved from `