09.10.2023, 11:37
Set element's Additional classes to colorize and display mode to either Icon or Icon and value.
Add to Custom CSS to hide the icon image.
Add to Custom JavaScript:
Add to Custom CSS to hide the icon image.
Code:
.colorize .icon img {
visibility: hidden;
}
Add to Custom JavaScript:
Code:
$(function(){
$('.colorize').each(function(_, el) {
var $el = $(el), addr = $el.data('object'), icon = $el.find('.icon');
grp.listen(addr, function(obj) {
var val = obj.value || 0;
val = Math.round(2.55 * (100 - val));
icon.css('background-color', 'rgb(' + val + ', 255, ' + val + ')');
});
});
});