GNU bug report logs -
#77841
Some svg image's black color is replaced by emacs's theme foreground color
Previous Next
Full log
Message #41 received at 77841 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 20 Apr 2025 13:56:37 +0100
> From: Alan Third <alan <at> idiocy.org>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 77841 <at> debbugs.gnu.org,
> Billy Lei <LeiYiXia29 <at> outlook.com>
>
> On Sun, Apr 20, 2025 at 12:19:02PM +0000, Ihor Radchenko wrote:
> > Alan Third <alan <at> idiocy.org> writes:
> >
> > >> 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.
> >
> > You are right, but you may be missing the context I am coming from.
> >
> <snip explanation>
> >
> > However, dvisvgm does _not_ use this method simply because it is not
> > fully portable - some browsers and svg viewers ignore fill
> > attribute. So, drawing background rectangle is often recommended for
> > svg. It is also apparently a common practice.
>
> Having reviewed our code we actually set the background the same way,
> by drawing a background coloured rectangle then inserting the SVG over
> it.
>
> I did a little digging and it looks as though explicitly setting the
> foreground colour to black is often considered bad practice, which I
> guess is why we see this a lot, although that practice is
> inconsistently applied. Even that German flag earlier in the thread
> didn't set the fill colour, but did set the stroke colour to black.
>
> > > 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 am not sure if Emacs should behave differently in this scenario or
> > not. It may be a judgment call and may also be non-trivial to implement.
>
> To be frank it probably should, but I don't know exactly *how* it
> should behave.
Do we have anything else to do here, or should this bug be closed
now?
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.