GNU bug report logs -
#77841
Some svg image's black color is replaced by emacs's theme foreground color
Previous Next
Full log
View this message in rfc822 format
On Sat, Apr 19, 2025 at 11:37:35AM +0000, Ihor Radchenko wrote:
> Alan Third <alan <at> idiocy.org> writes:
>
> >> Consider the attached svg image.
> >> ...
> >> Seemingly, background and foreground are inverted in the second case.
> >>
> >> What am I missing?
> >
> > The image draws a rectangle in the current foreground colour, black in
> > the first case and red in the second, and then fills the text with
> > "#fff".
> >
> > <g fill='#fff'>
>
> This image was generated by dvisvgm.
> It indeed explicitly draws a rectangle over the page, effectively
> inverting background and foreground (Emacs has no reason to apply
> background color to the rect object fill).
I don't understand what you mean, because it doesn't apply the
background colour to the rect. It shows as white on red. Red is the
foreground colour: the surrounding text is red. This is exactly the
same as the first case where the rect is filled with black because
black is the foreground colour.
If you believe Emacs should behave differently then I don't see any
reason why we can't change it, as long as it still allows the use of
SVGs inline as widgets or icons, etc. without forcing the programmer
to explicitly handle changes to colours when faces change, or the
mouse hovers over the line, etc.
I'm not an expert in SVG, so it's quite possible there's a better way
of doing this that I don't know.
If someone does have a proposal I'd suggest it should probably be made
in emacs-devel, because it will be a change to behaviour that will
likely interest anyone who already uses SVGs, and please Cc me in as I
don't read emacs-devel regularly.
--
Alan Third
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.