# String contraining HEX color to Color value

**URL:** <https://discourse.processing.org/t/string-contraining-hex-color-to-color-value/34380>\
**Category:** Beginners\
**Created:** [December 30, 2021, 5:55pm UTC](https://discourse.processing.org/t/string-contraining-hex-color-to-color-value/34380 "2021-12-30T17:55:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 30, 2021, 5:55pm UTC](https://discourse.processing.org/t/string-contraining-hex-color-to-color-value/34380/1 "2021-12-30T17:55:46Z")

</div>

I have a txt file that contains colors in the form of #01abEf and I want to load them and turn into processing color variable type. How can I do this?

How can I turn “#FF00FF” to color(255,0,255) ?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 30, 2021, 6:00pm UTC](https://discourse.processing.org/t/string-contraining-hex-color-to-color-value/34380/2 "2021-12-30T18:00:07Z")

</div>

Hello,

Take a look at:

- [https://processing.org/reference/unhex\_.html](https://processing.org/reference/unhex_.html)
- [https://processing.org/reference/String\_substring\_.html](https://processing.org/reference/String_substring_.html)

You will also have to restore the alpha…

[https://processing.org/reference/color\_datatype.html](https://processing.org/reference/color_datatype.html)

I am confident you can do the rest…

`:)`
