So, I know I can set a pixel's color with a HEX value,

So, I know I can set a pixel’s color with a HEX value, leds[i] = 0xRRGGBB;, but how would I implement that for fill_solid? For example, I have an array of specific colors (in HEX): colors[] = {0x112233, 0x445566, 0x778899}; And what I’d like to do is use fill_solid to fill parts of the string with one of those colors. Something like,
fill_solid(&(leds[0]), 12, CRGB(pick-random-color));

Or should I have the array filled with different datatypes that CRGB (or CHSV) can read in easily?

Make your colors array uint32_t - then you should be able to do

fill_solid(leds, 12, colors[random(3)]);

(assuming there’s 3 colors in your color array). C++ type conversion should convert to CRGB for you. That’s how things like CRGB::Black works - CRGB::Black is just an enum value set to 0x000000 :slight_smile:

Yeah, it is uint32_t already. I just wasn’t sure how to pass it back to fill_solid(). Cool, I’ll play with it and see what I get.

I think:
fill_solid( &(leds[0]), 12, colors[ rand()] );
should work, giving your colors array.

Here’s something I’ve never done before: posted code partially written by the kid. I contributed the ARRAY_LENGTH macro, and gave (lots of) C++ syntax help. The color choices are hers.

#define ARRAY_LENGTH(A) (sizeof(A)/sizeof(*A))

CRGB TheAwesomeColors[] =
{
0x550099,
CRGB::Fuchsia,
CRGB::Aqua,
CRGB::DarkCyan,
CRGB::Gold,
0xFF99F5,
CRGB::MediumVioletRed,
CRGB::RoyalBlue,
};

CRGB GetAnAwesomeColor()
{
int colorNumber = random8( ARRAY_LENGTH( TheAwesomeColors ));
return TheAwesomeColors[ colorNumber ];
}

// Then you can:

fill_solid(leds, 12, GetAnAwesomeColor());

Yep, that’s actually where the actual code is going to. I just needed the bare bones method … I like starting on the ground level and build from there. :slight_smile: