# Get() returns one number in RGB mode?

**URL:** <https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542>\
**Category:** Beginners\
**Created:** [April 8, 2020, 2:31pm UTC](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542 "2020-04-08T14:31:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanjoc](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@juanjoc](https://discourse.processing.org/u/juanjoc)\
**Post date:** [April 8, 2020, 2:31pm UTC](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542/1 "2020-04-08T14:31:07Z")

</div>

Hello everyone.

I do not understand why get does not return R, G, B values instead of 1 single signed number. I am trying to get the background color and then create a rect() with the same color (fill(R,G,B)) as the background. My code is:

```auto
int backgroundColor;
void setup()
{
  orientation(LANDSCAPE); 
  size(displayWidth, displayHeight);
  background(random(0,255),random(0,255),random(0,255));
  backgroundColor=get((int)displayWidth/2, (int)displayHeight/2);
}
void draw()
{
  println(backgroundColor);
  fill(backgroundColor);
  rect(displayWidth/2,)displayHeight/2, displayWidth*0.6, )displayHeight*0.6)
}

```

Could you please help to get the RGB values correctly??

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [April 8, 2020, 2:41pm UTC](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542/2 "2020-04-08T14:41:16Z")

</div>

The documentation may seem a bit obscure [https://www.processing.org/reference/color\_datatype.html](https://www.processing.org/reference/color_datatype.html) color is not a datatype at all, the processing pre-processor converts color to a signed int. There are convenience methods red(value), green(value), blue(value), that extract those values from the signed int.

---

<div class="post-metadata">

**Author:** ![wuzywute](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wuzywute/32/8710_2.png) [@wuzywute](https://discourse.processing.org/u/wuzywute)\
**Post date:** [April 8, 2020, 3:29pm UTC](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542/3 "2020-04-08T15:29:44Z")

</div>

could you set your color values to variable and use the same variables on your RECT as your BACKGROUND?
