Appending more than one color to an array loop of colors

color [] getColorListShuffled() {

  color from = color (random(255), random(255), random(255));
  color to = color (random(255), random(255), random(255));
  float step = 1.0f / (cells.length -2); // *** when I append second color I change to cells.length -3 
  IntList inventory_1 = new IntList (cells.length);


  for (int k = 0; k < cells.length; k++) {
    inventory_1.set (k, lerpColor (from, to, k*step));
    inventory_1.append (color (255));
    //inventory_1.append (color (0)); *** does not work when I add second color
  }
  inventory_1.shuffle();
  return inventory_1.array();
}

Just my guess, but it looks like you are reinitializing the array every time. Therefore you can only ever add one item.

IntList inventory_1 = new IntList (cells.length);

try placing that line of code somewhere outside of the loop.