# Color Shuffle with hex color codes

**URL:** <https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191>\
**Category:** Coding Questions\
**Created:** [June 23, 2018, 11:15pm UTC](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191 "2018-06-23T23:15:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [June 23, 2018, 11:49pm UTC](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191/5 "2018-06-23T23:49:44Z")

</div>

Behind the scenes, `color` isn’t really a type. Processing automatically converts `color` values into `int` values. That’s why the `color` type doesn’t work with Java code: Java doesn’t know about this `color` to `int` magic.

To get your example working, you can use `Integer` values instead:

```auto
import java.util.*;

Integer[] array;
List<Integer> l;

void setup() {
  size(600,600);
  array = new Integer[]{#FEF0D5, #D81E5B, #F35B68, #00BEB2, #1A5D63};
  // Shuffle the elements in the array
  l = Arrays.asList(array);
  printArray("original order: " + l);
}

void draw() {
  color c = array[0];
  background(c);
}

void keyPressed() {
  Collections.shuffle(l);
  printArray("new order: " + l);
}

```

Also notice the code inside the `draw()` function which treats the `Integer` value like a `color`. Processing knows that `color` values are really `int` values, so this will work.

By the way, the `Color` type (with an upper-case `C`) is a Java-specific class that you should (almost) never use in Processing.

---

_[View the full topic](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191)._
