From 206c34528ca288138091d6a97c381da646fa1c2c Mon Sep 17 00:00:00 2001
From: Marco Beretta <81851188+berry-13@users.noreply.github.com>
Date: Wed, 24 Jun 2026 15:57:15 +0200
Subject: [PATCH] fix: resolve CSS paints onto rendered painters and skip
overridden use fills
---
client/src/utils/__tests__/svg.test.ts | 30 +++++
client/src/utils/svg.ts | 148 +++++++------------------
2 files changed, 72 insertions(+), 106 deletions(-)
diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts
index 491084e128..ad86bb6cb1 100644
--- a/client/src/utils/__tests__/svg.test.ts
+++ b/client/src/utils/__tests__/svg.test.ts
@@ -208,6 +208,18 @@ describe('isMonochromeSvg', () => {
'';
expect(isMonochromeSvg(svg)).toBe(true);
});
+
+ it('tints a referenced glyph whose own fill overrides the use fill', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('still counts a use fill that the referenced shape inherits', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(false);
+ });
});
describe('currentColor resolved against a fixed color', () => {
@@ -308,6 +320,24 @@ describe('isMonochromeSvg', () => {
'';
expect(isMonochromeSvg(svg)).toBe(false);
});
+
+ it('tints a glyph whose root CSS fill is overridden by every rendered shape', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('tints a glyph whose CSS group fill no rendered shape inherits', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('still counts a CSS container fill inherited by an unpainted shape', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(false);
+ });
});
describe('default fills alongside