diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-07-27 12:52:51 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-07-27 12:54:47 +0200 |
commit | c2081d28740e03d43b9dbbe9dbd5ac6484e8953a (patch) | |
tree | eb1c8ac0965fee0139ee58db131a142b2150b4c8 /dw/widget.cc | |
parent | 59b746f013f60050b91cb5f6f8dd4a96c47f380e (diff) |
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.
Diffstat (limited to 'dw/widget.cc')
-rw-r--r-- | dw/widget.cc | 17 |
1 files changed, 17 insertions, 0 deletions
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 |