# How to turn color from get() function into an RGB value

**URL:** <https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908>\
**Category:** Processing.py\
**Created:** [December 2, 2020, 11:34pm UTC](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908 "2020-12-02T23:34:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![perrywinkle](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@perrywinkle](https://discourse.processing.org/u/perrywinkle)\
**Post date:** [December 2, 2020, 11:34pm UTC](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908/1 "2020-12-02T23:34:01Z")

</div>

I’m having the user pick a color to use in a generated artwork by clicking on a point on an image of a color wheel. This is my code:

def mousePressed():  
if pick\_color:  
c = get(mouseX, mouseY)  
print©  
pick\_color = False  
startscreen = True

For example, if I click on a pink color, c returns -1888365. I can plug color(-1888365) in my function and it works as it should but the problem is that I’m trying to fade between colors. So if the color were normally expressed as (255, 51, 153) in RGB colors, I could make the first layer (255, 51, 153), the second layer (127, 26, 76), and the third layer (0, 0, 0), so the colors would fade from black to pink. However, when the value is expressed as -1888365, it makes it impossible to do this. Any idea how the get() function works and how I can transform it into RGB? This [page](https://py.processing.org/reference/get.html) says it should return an RGB value by default but it doesn’t.

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [December 2, 2020, 11:40pm UTC](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908/2 "2020-12-02T23:40:14Z")

</div>

Welcome @perrywinkle

You can use the `red()`, `green()`, `blue()` functions to extract the RGB values:

```python
background(255, 200, 10)
c = get(10, 10)
print(red(c)) # 255.0
print(green(c)) # 200.0
print(blue(c)) # 10.0

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [December 2, 2020, 11:41pm UTC](https://discourse.processing.org/t/how-to-turn-color-from-get-function-into-an-rgb-value/25908/3 "2020-12-02T23:41:28Z")

</div>

> [@perrywinkle](#):
>
> Any idea how the **get()** function works and how I can transform it into RGB?

> **[\>\> (right shift) \\ Language (API)](https://py.processing.org/reference/rightshift.html)**
>
> Python Mode for Processing extends the Processing Development Environment with the Python programming language.
