Here's a straightforward way using a Table
where you make the list and the colors, and then match them.
list = Symbol /@ CharacterRange["a", "n"];
color = {Red, Green, Blue};
Table[Style[list[[ii]], color[[Mod[ii, Length[color]] + 1]]], {ii, 1, Length[list]}]
If you wish to specify the colors manually, that's easy too
list = Symbol /@ CharacterRange["a", "n"];
color = {Black, Red, Green, Blue};
locations = {2, 3, 4, 2, 3, 4, 2, 2, 1, 1, 1, 1, 1, 1};
Table[Style[list[[ii]], color[[locations[[ii]]]]], {ii, 1, Length[list]}]
Since some of the comments seems to want to do this withoutHere's a way that bypasses the Table
function, here's a way usingand uses MapThread
that allows arbitrary specification ofinstead. You can choose the colors in the list colscol
. manually, by algorithm, or choose them randomly:
list = Symbol /@ CharacterRange["a", "n"];
cols = RandomChoice[{Red, Green, Blue, Red, Green, Blue, Red, Red, Black}, Black,Length[list]]; Black, Red, Red, Black};
MapThread[Style[#1, #2] &, {list, cols}]