Subject: bug#73417: 30.0.90; SVG text color on dark background

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Sep 2024 10:58:13 +0300

> From: Augusto Stoffel <[email-masked]>
> Date: Sun, 22 Sep 2024 09:25:10 +0200
> 
> When I open the attached SVG files in Emacs with a dark background
> theme, I notice that the text color "adapts" to the theme and becomes
> white.  This works nicely (but see below) when the SVG has a transparent
> background (example on the right), but renders unreadable a SVG with
> regular white background (example on the left).

You (or a Lisp program which displays such SVG) are supposed to define
a suitable face for it, to countermand these situations.  When Emacs
displays an SVG image, it takes the face colors into consideration, if
the colors are defined for the face.

> I would argue that Emacs should the same behavior as web browsers, for 2
> reasons:
> - While it might seem nice to adapt text color to the surroundings, note
> that the right-hand side example is in Emacs is still problematic, since
> one can't really see the black square frame around the blue plot.
> - It would be hard to argue with any SVG producer that their SVGs are
> broken if browsers display them just fine.

Emacs doesn't automatically "fix" colors because they are unreadable,
it leaves that to the Lisp programs.  We don't do that for text, and
I'm not sure I understand why we should make SVG an exception.  From
the Emacs POV, SVG is just a display element, similar to character
glyphs, so we use the same general strategy here.