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

Full log


View this message in rfc822 format

From: Alan Third <alan <at> idiocy.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 77841 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Billy Lei <LeiYiXia29 <at> outlook.com>
Subject: bug#77841: Some svg image's black color is replaced by emacs's theme foreground color
Date: Sun, 4 May 2025 19:11:33 +0100
[Message part 1 (text/plain, inline)]
On Sun, May 04, 2025 at 07:17:46PM +0200, Manuel Giraud wrote:
> Thanks Alan.  I've tested your patch and here is what I observe. What's
> good:
> 
>        - SVG Emacs "widgets" are still using the default face color and
>          are updating accordingly when changing theme
> 
>        - I use Gnus and I see the same behaviour for the SVG icon in the
>          modeline
> 
>        - The german flag example provided by Billy is displayed
>          correctly (filled with black where needed) whatever the theme
>          in use
> 
>        - The example from Ihor shows 'x²=2' written in white on black
>          whatever the theme in use

Thanks for checking.

> What's not so good:
> 
> I use DocView (with mupdf to generate SVG pages) and I have set
> 'doc-view-svg-face' to "inherit default" so that DocView buffers are
> also following the theme.  This used to work but now, with this patch,
> it does not render correctly.  For example, the text stays black instead
> of white with a dark background theme.
> 
> Maybe, it is something that should be fixed in DocView (?)

We could probably fix it by getting Docview to set the :css property
for the SVG image to something like:

    svg {
      fill: currentcolor;
    }

Is the background OK?

The attached might work, but only if you're using librsvg 2.48 or
above... I can think of a way to fix *that* problem, but it'll need a
little more thought.

-- 
Alan Third
[0001-Use-css-to-set-SVG-foreground-in-docview.patch (text/x-diff, attachment)]

This bug report was last modified 7 days ago.

Previous Next


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