setting up a 2 dimensional array with RGB values

int black[4] = {0, 0, 0, 0};
int white[4] = {0, 0, 0, 100};
int red[4]   = {100, 0, 0, 0};
int green[4] = {0, 100, 0, 0};
int blue[4]  = {0, 0, 100, 0};
int yellow[4] = {40, 95, 0, 0};
int purple[4] = {50, 0, 100, 0};

Can I do this, and then something like this?

int colors[][4] = {black[]}, {white[]};

This doesn’t work, but am I close, or do I have to just list all the values directly in the line where I initiate colors?
I’d like to get them where I can easily loop thru colors, like this:

int colorCount = 7;
for (int i = 0; i < colorCount; i++) {
display(colors*);*
i += 1;
}

Can I do this

Obviously.

and then something like this?

No.

Why do you need an array of arrays? That is not the same as a 2D array. Which do you want? An array of pointers to arrays would be one way. A read 2D array would be another.

int colorCount = 7;
for (int i = 0; i < colorCount; i++) {
display(colors);
i += 1;
}

I’ certain that your code doesn’t look like that. And, now you know why we expect you to use code tags.

On one of my back burner RGB projects, I was thinking about doing something similar, except storing many web colors (R, G, B) in program memory (PROGMEM).... http://arduino.cc/en/Reference/PROGMEM

So, I was thinking of storing a array of R, G, B values, one array for each color (or maybe better to use one array and index each color in multiples of 3), all colors in program memory. Only problem is that I would be changing colors while maintaining the same LED brightness by using HSB color scheme instead of RBB color scheme. That means I'd need a function() to convert the stored color values in RGB to HSB, then convert them back to RGB at the appropriate brightness. The resultant RGB values would then be used to drive the LED output pins.

Looked, but didn't find a RGB library that converts both ways, only found HSB to RGB. I did find formulas, so I should be able to code conversion functions for ways.

Gamma correction is more important than RGB vs. HSB representation. The sRGB standard would be a good starting point.

Why not just make one large array, then step thru it in increments of 4?
Something like this:

byte colorCount = 28;
for (byte i = 0; i < colorCount+1; i=i+4) {
display(colors[i+0, i+1, i+2, i+3);
}

(tweak as needed to stop at the right place, I think I have it going one group too far)

Thanks for all the input. I figured out I can do this, which seems to work well. And I can add colors to it easy enough.

//constant color definitions
int colors[][10] = {
  {0, 0, 0, 0}, //black
  {0, 0, 0, 100}, //white
  {100, 0, 0, 0}, //red
  {0, 100, 0, 0}, //green
  {0, 0, 100, 0}, //blue
  {40, 95, 0, 0}, //yellow
  {50, 0, 100, 0}, //purple
};

Then I should be able to access the colors with just 1 variable - the row number of the array, something like this:

for (int i = 0; i < colorCount; i++) {
redVal = colors[i][0];
greenVal = colors[i][1];
blueVal = colors[i][2];
whiteVal = colors[i][3];
displayLights();
delay(10000);
}

I would think that something like this would make more sense:

//constant color definitions
const byte colors[][4] = {
  {0, 0, 0, 0}, //black
  {0, 0, 0, 100}, //white
  {100, 0, 0, 0}, //red
  {0, 100, 0, 0}, //green
  {0, 0, 100, 0}, //blue
  {40, 95, 0, 0}, //yellow
  {50, 0, 100, 0}, //purple
};
const int colorCount = 7;

void setup() {
}

void loop() {
  for (int i = 0; i < colorCount; i++) {
    displayLights(colors[i]);
    delay(10000);
  }
}

void displayLights(const byte color[4]) {

}

Why make each color 10 entries long if you are only using 4?
Why split the color array into a bunch of globals rather than just passing the array?
Why use int when your values fit in a byte?

Byte instead of int that'll save memory, especially if I add more colors.

[4] versus [10] I thought the number of entries, not the number of items in each entry.

thanks. That's a very good improvement. I'm just a self taught programmer with no schooling other than Arduino.com