GNU bug report logs -
#73417
30.0.90; SVG text color on dark background
Previous Next
To reply to this bug, email your comments to 73417 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73417
; Package
emacs
.
(Sun, 22 Sep 2024 07:26:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Augusto Stoffel <arstoffel <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 22 Sep 2024 07:26:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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).
[emacs.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
If I embed the SVGs on a simple HTML, the text color is not influenced
by the HTML background color:
[firefox.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
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.
For reference, here are the SVGs, which by the way where generated with
Python's matplotlib library as follows:
```
import matplotlib.pyplot as plt
plt.plot([1,2]); plt.savefig("x-white.svg")
plt.plot([1,2]); plt.savefig("x-transparent.svg", transparent=True)
```
[x-white.svg (image/svg+xml, attachment)]
[x-transparent.svg (image/svg+xml, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73417
; Package
emacs
.
(Sun, 22 Sep 2024 07:59:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 73417 <at> debbugs.gnu.org (full text, mbox):
> From: Augusto Stoffel <arstoffel <at> gmail.com>
> 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.
This bug report was last modified 265 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.