ws2812b control of html colours

Hi i'm a newbie here wondered if anyone shed light and point me in the right direction as to what i need to do ,
the project i have works fine and consists of 2 ws2812 light strips,1 servo,1 lcd display, 2 relays and a sound chip the goal was to include this in a Droid i'm currently building

so far 1 light works with the sound chip for the weapon , the second is for the eye light

the sounds the sounds are stored as numbers so i can call a number to play and also be able to play the next sound by just adding 1 each time i press button

however i'm now wanting to be able to change the colour of the one strip i use for eye in a similar approach to the weapon sounds. how do i make the html colours into a table of numbers selectable that changes. as at the moment i only have
#define EyeColour Red
if i want to change it to e.g blue i have to change the EyeColour variable

what i want is to be able to call a number for e.g 1 (SelectEyeColour) and be able increment the number which changes to one stored in a table so each time i press a select button
i.e
1=red , 2=blue , 3=green , 4=white etc... so when i call "EyeColour" i can select the next colour by just adding 1

Make an array of eye colors.

thanks , i wasn't sure what i was trying to ask , i should be able to figure out what i need to do now

LionSri:
how do i make the html colours into a table of numbers selectable that changes

As groundFungus said, you might just need an array.

Sometimes it is useful to have a ‘palette’ of colours so you can pick a colour with a single number (the palette index).

I have attached a header file which creates arrays for a palette I use.
You can see the colours in this palette by looking at colour_palette.html

You can then more easily use the colours like:

#include <palette.h>

// Use an array for a particular sequence of colours to step thru:
//
byte StepColours[5]= { WHITE, RED, GREEN, YELLOW, BLUE };


// 'colour' is a number 0 to 255 which picks a colour from the palette
// - get the separate r,g,b values like this:
//
colour= StepColours[2];   // step to colour '2'

red= pgm_read_byte_near(pal_red + colour);
green=  pgm_read_byte_near(pal_green + colour);
blue= pgm_read_byte_near(pal_blue + colour);

You can also step thru the whole palette from colour 0 to colour 239 to get a rainbow colour effect.

Yours,
TonyWilk

EDIT attached colour_palette.html in a .zip file

palette.h (5.14 KB)

colour_palette.zip (2.06 KB)

[quote author=TonyWilk link=msg=3591743 date=1517663143]

Sometimes it is useful to have a 'palette' of colours so you can pick a colour with a single number (the palette index).

Thanks Tony , that is just perfect for what i'm looking for