# Get() returns RGB values while the colorMode is set to HSB

**URL:** <https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827>\
**Category:** Beginners\
**Created:** [July 25, 2020, 2:18am UTC](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827 "2020-07-25T02:18:00Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [August 15, 2020, 7:23pm UTC](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827/8 "2020-08-15T19:23:41Z")

</div>

> [@aks9](#):
>
> The only way I know of is by using `get()` , which I can’t combine with the HSB functions. That’s why using the Hue, Saturation, or Brightness won’t work, since they require H or S or B values as their inputs, but `get()` only gives you R, G and B.

[https://p5js.org/reference/#/p5/get](https://p5js.org/reference/#/p5/get)

> Returns an array of [R,G,B,A] values for any pixel

```auto
get(x, y)

```

> **[reference | p5.js](https://p5js.org/reference/#/p5/hue)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

> Extracts the hue value from a color or **pixel array**.  
> Hue exists in both HSB and HSL. This function will return the HSB-normalized hue when supplied with an HSB color object **(or when supplied with a pixel array while the color mode is HSB)**

I tested this and it works for H and B but did not seem to give correct value for S.

A little exploration lead me to this:  
[https://github.com/processing/p5.js/issues/4667](https://github.com/processing/p5.js/issues/4667)  
[https://github.com/processing/p5.js/issues/1620](https://github.com/processing/p5.js/issues/1620)

The above issues also cross link to other related issues if you care to follow those.

One of the posts said this works correctly:  
[https://bgrins.github.io/TinyColor/](https://bgrins.github.io/TinyColor/)

Additional resources:

> **[home | p5.js](https://p5js.org/)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

See references:

- Color
- Pixels

> **[learn | p5.js](https://p5js.org/learn/)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

See:

- Color

`:)`

---

_[View the full topic](https://discourse.processing.org/t/get-returns-rgb-values-while-the-colormode-is-set-to-hsb/22827)._
