ZackFreedman / Chromance

Emotions and hexagons and RGB oh my!
MIT License
136 stars 21 forks source link

Set Ripples to select color from set list #8

Open TomWaterz opened 2 years ago

TomWaterz commented 2 years ago

Can someone help me figure out how to generate ripple colors from a set array of color values? I've tried doing it but can't seem to figure out how the color wheel works.

I have something like this

char colorOptions[3] = {'#FFA233', '#DC0000', '#8F00AB'};

and just want each ripple to randomly choose a color from this array.

EasyAsABC123 commented 1 year ago

Here are the code locations where colors are chosen: randomPulse color generation cubePulse color selection starburst color selection

These all rely on baseColor, which is randomly generated on this line

If you switch out baseColor with a random selection from your array this should "work".

unsigned int baseColor = colorOptions[random(NUMBER_OF_COLORS)];

Minor correction to your array declaration, we also would need some code to convert from these hex values to their int counterpart (not shown in my examples).

    const int NUMBER_OF_COLORS = 3;
    const char* colorOptions[] = {"#FFA233", "#DC0000", "#8F00AB"};