From 1d4da287eaf18b50aff561ec12dbb890fccb8281 Mon Sep 17 00:00:00 2001
From: Marco Beretta <81851188+berry-13@users.noreply.github.com>
Date: Thu, 25 Jun 2026 01:19:47 +0200
Subject: [PATCH] fix: skip transparent svg use references
---
client/src/utils/__tests__/svg.test.ts | 18 ++++++++++++++
client/src/utils/svg.ts | 33 +++++++++++++++++++++-----
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts
index 30e0394075..9eddf27ba8 100644
--- a/client/src/utils/__tests__/svg.test.ts
+++ b/client/src/utils/__tests__/svg.test.ts
@@ -209,6 +209,24 @@ describe('isMonochromeSvg', () => {
expect(isMonochromeSvg(svg)).toBe(true);
});
+ it('ignores a referenced color rendered only through an opacity-zero use', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('ignores a nested referenced color hidden by an opacity-zero use', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
+ it('ignores a default-black use hidden with opacity zero', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
+
it('tints a referenced glyph whose own fill overrides the use fill', () => {
const svg =
'';
diff --git a/client/src/utils/svg.ts b/client/src/utils/svg.ts
index 54c7e4f8d6..32943df263 100644
--- a/client/src/utils/svg.ts
+++ b/client/src/utils/svg.ts
@@ -342,8 +342,8 @@ function currentColorTones(
* instantiating `