From a3512261e4ba7d58e69a74a806cd5e188a9f15b0 Mon Sep 17 00:00:00 2001
From: Marco Beretta <81851188+berry-13@users.noreply.github.com>
Date: Fri, 26 Jun 2026 21:08:29 +0200
Subject: [PATCH] fix: propagate outer use color through nested currentColor
references
---
client/src/utils/__tests__/svg.test.ts | 18 ++++++
client/src/utils/svg.ts | 86 +++++++++++++++++---------
2 files changed, 76 insertions(+), 28 deletions(-)
diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts
index 4e5050d1c0..6ac459b78e 100644
--- a/client/src/utils/__tests__/svg.test.ts
+++ b/client/src/utils/__tests__/svg.test.ts
@@ -342,6 +342,24 @@ describe('isMonochromeSvg', () => {
'';
expect(isMonochromeSvg(svg)).toBe(false);
});
+
+ it('preserves a nested-use currentColor glyph fixed by the outer use color', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(false);
+ });
+
+ it('preserves a nested-use currentColor glyph fixed by the inner use color', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(false);
+ });
+
+ it('tints a nested-use currentColor glyph with no fixed color at any use', () => {
+ const svg =
+ '';
+ expect(isMonochromeSvg(svg)).toBe(true);
+ });
});
describe('paint set on non-rendering containers', () => {
diff --git a/client/src/utils/svg.ts b/client/src/utils/svg.ts
index 77798517c5..29f6b8f980 100644
--- a/client/src/utils/svg.ts
+++ b/client/src/utils/svg.ts
@@ -332,55 +332,85 @@ function resolveCurrentColor(el: Element, boundary: Element, rules: StyleRule[])
return CURRENT_COLOR;
}
+/**
+ * The fixed color a `currentColor` paint resolves to for one instantiation chain.
+ * The chain lists the `