# \[DEPRECATED Thread: visit community.webcore.co for assistance\] webCoRE - Piston Design Help (ask your fellow members for assistance)

**URL:** <https://community.smartthings.com/t/deprecated-thread-visit-community-webcore-co-for-assistance-webcore-piston-design-help-ask-your-fellow-members-for-assistance/86345>\
**Category:** webCoRE\
**Tags:** core, webcore\
**Created:** [May 2, 2017, 4:29pm UTC](https://community.smartthings.com/t/deprecated-thread-visit-community-webcore-co-for-assistance-webcore-piston-design-help-ask-your-fellow-members-for-assistance/86345 "2017-05-02T16:29:14Z")\
**Posts on this page:** 1\
**Showing post:** 4003

<div class="post-metadata">

**Author:** ![ady624](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ady624/32/32610_2.png) [@ady624](https://community.smartthings.com/u/ady624)\
**Post date:** [July 29, 2017, 1:47pm UTC](https://community.smartthings.com/t/deprecated-thread-visit-community-webcore-co-for-assistance-webcore-piston-design-help-ask-your-fellow-members-for-assistance/86345/4003 "2017-07-29T13:47:36Z")

</div>

I fixed the regex adding color swatches to anything it matches like an RGB code - it was updating the styling too - should be fixed now.

The rangeValue returns a matching value like so:

```
rangeValue(input, defaultValue, point1, value1, ..., pointN, valueN)

```

it takes the input and starts comparing it with each point, if the input is found to be larger or equal to a point, the value corresponding to that point is used instead of the default.

rangeValue(10, ‘#000000’, 3, ‘#400000’, 6, ‘#800000’, 9, ‘#c00000’, 12, ‘#f00000’) returns ‘#c00000’ as input (10) is only larger than the 3rd point, not the 4th.

there is another perhaps better choice:

```
rainbowValue(input, min, minColor, max, maxColor)

```

This will return a color between minColor and maxColor, keeping the scale between min and max. Thanks to @ahndee for the inverse HSL gradient idea

```
rainbowValue(75, 60, 'Blue', 90, 'Red') will give you green #00ff00

```

 ![image](https://global.discourse-cdn.com/smartthings/original/3X/3/a/3a6dc81c809f9341ba7b43639c930a18f2f91cc9.png)

---

_[View the full topic](https://community.smartthings.com/t/deprecated-thread-visit-community-webcore-co-for-assistance-webcore-piston-design-help-ask-your-fellow-members-for-assistance/86345)._
