Re: Question regarding styling input checkbox element

<[email protected]> Wed, 21 May 2025 14:07:44 +0000
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi Rodrigo,

Rodrigo Arias <[email protected]> wrote:

> For some reason is always hardcoded to be black. Here is making it 
> always red:

Thanks, looks great now!

> See commit fa967f233fe6da82a98aaf3e2149d7aa5e1516cc for context, but
> not sure why is not just inheriting the CSS foreground color.

Here is a working patch which I believe fixes it so that it uses the
foreground color:

diff -upr a/dw/fltkui.cc b/dw/fltkui.cc
--- a/dw/fltkui.cc   Sun Apr 27 18:56:44 2025
+++ b/dw/fltkui.cc   Wed May 21 14:01:08 2025
@@ -1171,8 +1171,12 @@ void FltkToggleButtonResource<I>::setWidgetStyle
 (Fl_W core::style::Style *style)
 {
    FltkResource::setWidgetStyle(widget, style);
-
-   widget->selection_color(FL_BLACK);
+   FltkColor *bg = (FltkColor*)style->backgroundColor;
+   int normal_bg = bg->colors[FltkColor::SHADING_NORMAL];
+   int style_fg = ((FltkColor*)style->color)->colors
+   [FltkColor::SHADING_NORMAL];
+         Fl_Color fg = fl_contrast(style_fg, normal_bg);
+   widget->selection_color(fg);
 }


Regards,
Alex
_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]