GNU bug report logs - #77841
Some svg image's black color is replaced by emacs's theme foreground color

Previous Next

Package: emacs;

Reported by: Billy Lei <LeiYiXia29 <at> outlook.com>

Date: Wed, 16 Apr 2025 12:16:02 UTC

Severity: normal

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Billy Lei <LeiYiXia29 <at> outlook.com>
Subject: bug#77841: closed (Re: bug#77841: Some svg image's black color is
 replaced by emacs's theme foreground color)
Date: Thu, 10 Jul 2025 17:03:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 77841 <at> debbugs.gnu.org.

-- 
77841: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77841
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Third <alan <at> idiocy.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: yantar92 <at> posteo.net, 77841-done <at> debbugs.gnu.org, manuel <at> ledu-giraud.fr,
 LeiYiXia29 <at> outlook.com
Subject: Re: bug#77841: Some svg image's black color is replaced by emacs's
 theme foreground color
Date: Thu, 10 Jul 2025 18:01:55 +0100
On Thu, Jul 10, 2025 at 09:03:31AM +0300, Eli Zaretskii wrote:
> 
> > Am I good to go ahead and push this to master? It's currently in 4
> > separate commits.
> 
> Feel free, and thanks.

Done, thanks.
-- 
Alan Third

[Message part 3 (message/rfc822, inline)]
From: Billy Lei <LeiYiXia29 <at> outlook.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Some svg image's black color is replaced by emacs's theme foreground
 color
Date: Wed, 16 Apr 2025 20:09:46 +0800
I found this issue when debugging org LaTeX preview, see 
https://list.orgmode.org/87cydchjqn.fsf <at> gmail.com/T/#ed7ba8310f82e8be8a2e7360df1568ed485434df3

> When using themes with background color set to #000000, and org-preview-default-process is set to dvisvgm, the LaTeX fragments are displayed incorrectly.
> 
> To reduplicate:
> 
> 1. Switch to a theme with background color set to #000000 (like Modus Vivendi)
> 2. Set org-preview-default-latex-process to dvisvgm
> 3. Create an org-mode document. Write some LaTeX fragment and press C-c C-x C-l to preview LaTeX fragment.
> 4. The LaTeX preview is displayed as a white rectangle.
> 
> After debugging, I found that it is because dvisvgm omitts the default #000 color value when generating SVG file, and emacs has a unique way of displaying the SVG, which caused foreground color to be applied to it.
> 
> A solution is to change org-format-latex-options to use transparent background by default. I've attached this fix.

It turned out that emacs displays svg images differently compared to an 
image viewer. I can reduplicate this issue when I use emacs to view this 
svg image, which emacs replaces the image's black color with the current 
theme's foreground color:

https://commons.wikimedia.org/wiki/File:Flag_of_the_German_Democratic_Republic.svg

See also (Chinese): https://emacs-china.org/t/emacs-30-1-svg/29217



This bug report was last modified 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.