Re: Dark mode screenshot and tutorial

Rodrigo Arias <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi,

On Tue, Jul 02, 2024 at 11:28:01AM +1000, Kevin Koster wrote:
>One issue with dark background colours is that PNG/GIF images with
>transparent backgrounds often have text in black and therefore become
>unreadable, such as this image on Wikipedia:
>https://en.wikipedia.org/wiki/File:Unix_timeline.en.svg
>
>I'm not good at CSS, but I just made an attempt to work around this by
>not setting img elements to black in my version of a dark-theme
>style.css, but it doesn't work, images backgrounds are still black:
>
>* {color: #00f400}
>  body, div, span, nav, p, a, form, h1, h2, h3, h4, h5, h6, ul, ol, li, table, tr, td {background-color: black}
>  img, map {background-color: gray !important}
>  :link {text-decoration: none !important; color: #00f5e8 !important}
>  :visited {text-decoration: none !important; color: #a020f0 !important}
>
>I don't know whether my CSS is invalid or if it's a bug in Dillo, but
>hints for applying black background-color to everything except images
>would be welcome. The image background is also black when I open it on
>its own with "isolate image" from the right-click menu, even though
>there it's on a light-colour background due to the 'bg_color' setting
>in dillorc being set to default. Presumably that's because the image
>in the cache already, loading a new PNG image URL the background is
>bg_color:
>https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Unix_timeline.en.svg/640px-Unix_timeline.en.svg.png

The implementation seems to be incomplete:

https://github.com/dillo-browser/dillo/blob/8c97be233a600f414952e458f59768e9ef265e28/src/png.c#L252-L262

The background color of the image is being assigned from the color of 
the <html> background. Try this patch to override it from the current
element:

diff --git a/src/html.cc b/src/html.cc
index a55fd2a8..649e7556 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2156,6 +2156,9 @@ DilloImage *a_Html_image_new(DilloHtml *html, const char *tag, int tagsize)
     if (HT2TB(html)->getBgColor())
        image->bg_color = HT2TB(html)->getBgColor()->getColor();

+   if (html->styleEngine->backgroundColor())
+      image->bg_color = html->styleEngine->backgroundColor()->getColor();
+
     DilloHtmlImage *hi = dNew(DilloHtmlImage, 1);
     hi->url = url;
     html->images->increase();
_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.