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

From: Alan Third <[email-masked]>
Date: Sat, 24 May 2025 21:56:59 +0100

On Sat, May 24, 2025 at 07:57:26PM +0200, Manuel Giraud wrote:
> With this and the same SVG I provided, the foreground color of the text
> is black using a light theme.  Using a dark theme, the foreground color
> of the text is white...  So that seems to do the trick.

Excellent, thanks.

I've pushed a branch scratch/svg-colors with the various fixes. Can
you please check it's working as you'd expect?

Can someone using librsvg < 1.48 please try it too? I'm including a
small script that should insert an SVG with two boxes, one follows the
theme colours the other stays with black and white.

If this all works then I suppose the documentation needs updated...

(insert-image
 (create-image
  "<svg viewbox='0 0 100 200'>
     <rect x='1' y='1' width='98' height='98'
           stroke='currentcolor' stroke-width='3'
           fill-opacity='0'/>
     <rect x='1' y='101' width='98' height='98'
           stroke='black' stroke-width='3'
           fill='white'/>

     <text x='8' y='15' fill='currentcolor' font-size='9px'>
       This text should
     </text>
     <text x='8' y='25' fill='currentcolor' font-size='9px'>
       follow the theme
     </text>
     <text x='8' y='35' fill='currentcolor' font-size='9px'>
       colours.
     </text>

     <text x='8' y='115' font-size='9px'>
       This text should
     </text>
     <text x='8' y='125' font-size='9px'>
       be black text on
     </text>
     <text x='8' y='135' font-size='9px'>
       a white
     </text>
     <text x='8' y='145' font-size='9px'>
       background.
     </text>
   </svg>"
  'svg t))

-- 
Alan Third