# ColorMode and ARGB values

**URL:** <https://discourse.processing.org/t/colormode-and-argb-values/31379>\
**Category:** Beginners\
**Created:** [July 22, 2021, 8:46am UTC](https://discourse.processing.org/t/colormode-and-argb-values/31379 "2021-07-22T08:46:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 22, 2021, 8:46am UTC](https://discourse.processing.org/t/colormode-and-argb-values/31379/1 "2021-07-22T08:46:45Z")

</div>

Just trying to figure out whats going on behind the scenes when using colorMode.

it can be set to greater than 255, however the values retrieved from it are then not accurate. And it doesnt seem to have a definitive conversion factor.

```auto
color bg;

void setup() {
  size(100, 100);
  //colorMode(HSB, 360, 100, 100);
  colorMode(RGB,1000);
  bg = color(180, 50, 50);
  println("col",red(bg));
}

void draw() {
  background(bg);  
}

```

---

<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:** [July 22, 2021, 10:26am UTC](https://discourse.processing.org/t/colormode-and-argb-values/31379/2 "2021-07-22T10:26:44Z")

</div>

Hello,

I usually start here to see what these Processing helper functions are doing:  
[https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java)

And I see that this `import java.awt.color.ColorSpace;` is used:  
[https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L44](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L44)  
[https://docs.oracle.com/javase/8/docs/api/java/awt/Color.html](https://docs.oracle.com/javase/8/docs/api/java/awt/Color.html)

`:)`

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 22, 2021, 10:41am UTC](https://discourse.processing.org/t/colormode-and-argb-values/31379/3 "2021-07-22T10:41:40Z")

</div>

thanks after further experiments I saved a file with values from 0,100000 in their color counterpart and it seems that the values are simply mapped with a modulus function. I was hoping the color space would be able to map individual values but unfortunately it doesnt function this way.

this is a sample of the output file and we can see that the color space is unable to provide individual values for each index.

```auto
92.1569, 364
392.1569, 365
392.1569, 366
392.1569, 367
392.1569, 368
392.1569, 369
392.1569, 370
392.1569, 371
392.1569, 372
392.1569, 373
392.1569, 374
392.1569, 375
392.1569, 376
392.1569, 377
392.1569, 378
392.1569, 379
392.1569, 380
392.1569, 381
392.1569, 382
392.1569, 383
392.1569, 384
784.3138, 385
784.3138, 386
784.3138, 387
784.3138, 388
784.3138, 389

```

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [July 29, 2021, 1:41pm UTC](https://discourse.processing.org/t/colormode-and-argb-values/31379/4 "2021-07-29T13:41:33Z")

</div>

Thanks for the help. In the end I’ve created a base 256 converter, this way I can fully utilise the range provided by the color() method and can therefore read and write numbers to later manipulate with shaders.
