Subject: bug#77841: Some svg image's black color is replaced by emacs's theme foreground color

From: Alan Third <[email-masked]>
Date: Tue, 8 Jul 2025 22:24:54 +0100

On Sat, Jun 28, 2025 at 06:22:26PM +0300, Eli Zaretskii wrote:
> > Date: Sat, 28 Jun 2025 15:44:55 +0100
> > From: Alan Third <[email-masked]>
> > Cc: [email-masked], [email-masked], [email-masked],
> > 	[email-masked]
> > 
> > > > Thanks. It's all looking good to me. I suppose it's really a question
> > > > of whether non-core code is relying on the current behaviour (I can
> > > > fix core code). My suspicion is no, but I have no actual evidence...
> > > > 
> > > > > I'll try to test with librsvg < 1.48... but I don't have it at hand.
> > > > 
> > > > Thanks. I don't think I've had it on one of my machines in years now...
> > > 
> > > Ping!  What should we do here to make further progress?
> > 
> > I'll send an email to emacs-devel describing the change and then I
> > guess we wait a bit and see if anyone has any objections?
> > 
> > Sound reasonable?
> 
> Yes, thanks.

It's been two week now, I think, and the only comment confirmed my
thought that this is a good change to make. So I think we go ahead
with it.

I've updated the documentation and written a NEWS entry, but I'm not
very confident about it (attached). If anyone has any thoughts, please
let me know.

-- 
Alan Third
>From 0e9ef2c6a0d8b314ac1dd8c41b9d8dd5542eab03 Mon Sep 17 00:00:00 2001
From: Alan Third <[email-masked]>
Date: Tue, 8 Jul 2025 18:06:14 +0100
Subject: [PATCH] Update documentation and NEWS with SVG changes (bug#77841)

* doc/lispref/display.texi (SVG Images):
* etc/NEWS: Document changes to SVG foreground color handling.
---
 doc/lispref/display.texi |  2 +-
 etc/NEWS                 | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 25ef83935c1..d044763523b 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6502,7 +6502,7 @@ SVG Images
 @table @code
 @item :foreground @var{foreground}
 @var{foreground}, if non-@code{nil}, should be a string specifying a
-color, which is used as the image's foreground color.  If the value is
+color, which is used as the CSS `currentcolor' value.  If the value is
 @code{nil}, it defaults to the current face's foreground color.
 
 @item :background @var{background}
diff --git a/etc/NEWS b/etc/NEWS
index 43477d438c3..74a6170ee26 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -511,6 +511,17 @@ or strings.  If set to 'on-mismatch', mismatched parens inside comments
 and strings will not be highlighted.  If set to nil (the default),
 highlight the parens wherever they are.
 
+** Change in SVG foreground color handling.
+SVG images no longer have the 'fill' attribute set to the value of
+':foreground' or the current text foreground color.  The 'currentcolor'
+CSS attribute continues to be set as before.
+
+This change should result in more consistent display of SVG images.
+
+To use the :foreground or current text color ensure the 'fill' attribute
+in the SVG is set to 'currentcolor', or set the image spec's ':css'
+value to 'svg {fill: currentcolor;}'.
+
 
 * Editing Changes in Emacs 31.1
 
-- 
2.45.2