In my book I need to use certain colors for certain chapters. One way to understand this is how to efficiently color a thumb index. I would like to make it easy to setup the colors in a data array(not a latex typographical array) and easily access the values from the array.
In a normal programming language you would do something like
var ThumbColors = {Red, Blue, Green, ...}
....
SetThumbColor(ThumbColors[k]) (where k maybe the current chapter or whatever)
Code like this allows one to separate the code from the data and hence makes it extremely easy to change the colors without having to find every instance of SetThumbColor. e.g., it is very bad to do this
SetThumbColor("red")
as it requires one to change every instance, who knows where, to change the colors.
So, I need some way to implement the first case.
\NewCommand{\ThumbColors}{{red, green, blue, ...}}
\SetThumbColor{...}
OR, even better, some way to use a dictionary(key-value pairs) in an easy way:
\NewCommand{\ThumbColors}{{chapter1 = red, chapter2 = green, chapter3 = blue, ...}}
\SetThumbColor{\GetThumbColors{chapter1}}
The main thing is it should be quick to type. It's very easy to do in a programming language and i don't want to have to do 15 lines of code just to do something similar to 1 or 2 lines(else why not just hard code it in the first place?)

clist. – Marco Daniel Jul 14 '12 at 14:14\csname my@array@<index>\endcsname. There is a performance implication depending on array size (due to hash table collisions). How big an array are we talking? See also Global key-value dictionary. – Joseph Wright Jul 14 '12 at 14:40