From c2081d28740e03d43b9dbbe9dbd5ac6484e8953a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sat, 27 Jul 2024 12:52:51 +0200 Subject: Add SVG support for currentColor The currentColor special value for the fill and stroke attributes allows an image to follow the same foreground color of the surounding text. --- dw/widget.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'dw/widget.cc') diff --git a/dw/widget.cc b/dw/widget.cc index edabce51..865023a1 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -1361,6 +1361,23 @@ style::Color *Widget::getBgColor () return layout->getBgColor (); } +/** + * \brief Get the actual foreground color of a widget. + */ +style::Color *Widget::getFgColor () +{ + Widget *widget = this; + + while (widget != NULL) { + if (widget->style->color) + return widget->style->color; + + widget = widget->parent; + } + + return NULL; +} + /** * \brief Draw borders and background of a widget part, which allocation is -- cgit v1.2.3