Hi, I want to be able to make a list of colors and choose one using an index number.
I can make 1 dimensional arrays no problem with strings, but I cannot seem to do it from colors.
does anyone know if it possible to make an array of colors?
if not, is there some similar way to do this?
right now I have code like this, which a really sloppy workaround:
color getColor(int ix) {
if (ix == 0) return (COLOR_0); // these COLOR_n are defined somewhere else
if (ix == 1) return (COLOR_1);
if (ix == 2) return (COLOR_2);
if (ix == 3) return (COLOR_3);
if (ix == 4) return (COLOR_4);
if (ix == 5) return (COLOR_5);
if (ix == 6) return (COLOR_6);
if (ix == 7) return (COLOR_7);
}
I can make 1 dimensional arrays no problem with strings, but I cannot seem to do it from colors.
does anyone know if it possible to make an array of colors?
if not, is there some similar way to do this?
right now I have code like this, which a really sloppy workaround:
color getColor(int ix) {
if (ix == 0) return (COLOR_0); // these COLOR_n are defined somewhere else
if (ix == 1) return (COLOR_1);
if (ix == 2) return (COLOR_2);
if (ix == 3) return (COLOR_3);
if (ix == 4) return (COLOR_4);
if (ix == 5) return (COLOR_5);
if (ix == 6) return (COLOR_6);
if (ix == 7) return (COLOR_7);
}