OpenHab HABPanel – Custom Widget – Change Color

The below example will look at itemName_thing and if the value is “off” then the text will be green else it will be red

<div class="col-xs-4 text-left" ng-style="{ color: itemValue('itemName_thing')=='off'?'green':'red' }">

This follows the standard Angular JS Ternary structure for an if statement

{ConditionVar ? 'varIsTrue' : 'varIsFalse'}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.