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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 24 May 2025 10:48:30 +0300

> Date: Fri, 23 May 2025 21:23:45 +0100
> From: Alan Third <[email-masked]>
> Cc: Ihor Radchenko <[email-masked]>,
> 	Billy Lei <[email-masked]>, Eli Zaretskii <[email-masked]>,
> 	[email-masked]
> 
> On Fri, May 23, 2025 at 03:42:53PM +0200, Manuel Giraud wrote:
> > Alan Third <[email-masked]> writes:
> > 
> > > On 23 May 2025 12:19:15 BST, Manuel Giraud <[email-masked]> wrote:
> > >>Alan Third <[email-masked]> writes:
> > >>
> > >>> On Fri, May 23, 2025 at 12:18:26PM +0200, Manuel Giraud wrote:
> > >>>> Hi Alan,
> > >>>> 
> > >>>> Here is what I get:
> > >>>
> > >>> Thank you. That's what I see too. Are you able to send me an example
> > >>> SVG as generated by docview?
> > >>
> > >>Sure.  Here is some book with light theme and a dark theme (pretty
> > >>unreadable ;-)
> > >
> > > Sorry, is it possible to get a copy of the actual SVG file, please? 
> > 
> > Here is an example from my docview cache.
> 
> Clearly an excellent document.
> 
> OK, I'm pretty sure that the first patch that affects image.c is
> working right, which means my mediocre lisp skills are biting me here.
> 
> Can you try running
> 
>     (concat "svg{fill:" (face-foreground 'doc-view-svg-face) "}")
> 
> and see what it returns?
> 
> Although it's only just now occurred to me that I have no idea what
> face-foreground might return, presumably things that aren't CSS
> compatible?
> 
> Hmm...
> 
> Can you try replacing line 1680 in lisp/doc-view.el with
> 
>     :foreground (face-foreground 'doc-view-svg-face)
>     :css "svg{fill:currentcolor;}")))
> 
> I think that's the right number of brackets...

Btw, please test these with librsvg v2.40.x, because 2.50 and newer
versions require Rust to build them.  So I'd like us to support those
older versions as much as reasonably possible.

Thanks.