# Convert int to hex color

**URL:** https://discourse.nodered.org/t/convert-int-to-hex-color/33394
**Category:** Dashboard
**Created:** [26 September 2020 21:05 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394 "2020-09-26T21:05:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)
#### Post date: [26 September 2020 21:05 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/1 "2020-09-26T21:05:07Z")

</div>

Hi,

In my flow I recall the value from a sensor and it can be between 0 and 1000.

I want to change the int to a hex color, where 0 will be blue, 500 green and 1000 red.

This will be use in World map to change the icon color from blue all the way to red relative the the sensor value.

Do you have an suggestions?

Thanks

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [26 September 2020 21:22 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/2 "2020-09-26T21:22:29Z")

</div>

> [@"Colour mapping" - help needed to create RGB value](https://discourse.nodered.org/t/colour-mapping-help-needed-to-create-rgb-value/33364/13):
>
> Here is an adaption of that code. As you didnt specify how you want RGB to be represented, I just spit out a whole bunch of different values (r,g,b,val,hex) in the payload object. Ignore the pink image nodes at the bottom - they are to demonstrate it working. [{"id":"e17b05ed.383be8","type":"inject","z":"f057b3e5.0b042","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":140,"wires":[["bfca8794.36a6e8"]]},{"i…

---

<div class="post-metadata">

### Author: ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)
#### Post date: [26 September 2020 21:42 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/3 "2020-09-26T21:42:12Z")

</div>

Thanks that is brilliant.

Only question what nodes are these? ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f2580d43e611467baa63927f5293bf6ecc7d6b0.png)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [26 September 2020 22:03 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/4 "2020-09-26T22:03:07Z")

</div>

You don't need them really, they were for demonstration only. But if you do, then look in the palette for node-red-contrib-image-tools.

---

<div class="post-metadata">

### Author: ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)
#### Post date: [26 September 2020 22:06 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/5 "2020-09-26T22:06:37Z")

</div>

> [@Steve-Mcl](#):
>
> node-red-contrib-image-tools

Thanks, I saw they were only for the demo, just could not recall what they were, used them long time ago.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 October 2020 22:06 UTC](https://discourse.nodered.org/t/convert-int-to-hex-color/33394/6 "2020-10-26T22:06:41Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
