# Use a Sensor to Colour Switch in HabPanel

**URL:** <https://community.openhab.org/t/use-a-sensor-to-colour-switch-in-habpanel/37880>\
**Category:** HABPanel\
**Tags:** sensor, wemo, habpanel\
**Created:** [December 28, 2017, 12:09pm UTC](https://community.openhab.org/t/use-a-sensor-to-colour-switch-in-habpanel/37880 "2017-12-28T12:09:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![scootaash](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@scootaash](https://community.openhab.org/u/scootaash)\
**Post date:** [December 30, 2017, 6:21pm UTC](https://community.openhab.org/t/use-a-sensor-to-colour-switch-in-habpanel/37880/3 "2017-12-30T18:21:10Z")

</div>

Thank you! Gave me a start to trying my own, I’ve combined your suggestion with the HabPanel widget help file [here](https://community.openhab.org/t/custom-widgets-feature-walkthrough/16670) and came up with the below if anyone wants to copy. Thanks for the headstart!

````auto
<div ng-if="itemValue(config.wemosensor)=='OFF'">
  <button class="btn btn-med" style="background: red; color: white"
  ng-click="sendCmd(config.wemoswitch, 'ON')">
  {{config.name}}
  </button>
</div>

<div ng-if="itemValue(config.wemosensor)=='ON'">
  <button class="btn btn-med" style="background: green; color: black"
  ng-click="sendCmd(config.wemoswitch, 'ON')">
  {{config.name}}
  </button>
</div>```
````

---

_[View the full topic](https://community.openhab.org/t/use-a-sensor-to-colour-switch-in-habpanel/37880)._
