Possible to decorate ON a widget rather than before or after?

(Steven Slade) #1

There is the ever useful api.decorateWidget('widget:before', dec => { }) that is perfect for adding elements before or after a widget.

I was wondering if it was possible to decorate on a widget. I want to add some dynamic style (specifically background-color) to div.extra-info-wrapper in the header-topic-info widget.

The color would be from the follow code using the attrs of the widget in question:

const topic = dec.attrs.topic;
const category = topic.get('category');
const catColor = category.get('color');