Skip to main content
deleted 57 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

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]}]

enter image description here

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]}]

enter image description here

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}]

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]}]

enter image description here

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]}]

enter image description here

Since some of the comments seems to want to do this without the Table function, here's a way using MapThread that allows arbitrary specification of the colors in the list cols.

list = Symbol /@ CharacterRange["a", "n"];
cols = {Red, Green, Blue, Red, Green, Blue, Red, Red, Black, Black, Black, Red, Red, Black};
MapThread[Style[#1, #2] &, {list, cols}]

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]}]

enter image description here

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]}]

enter image description here

Here's a way that bypasses the Table and uses MapThread instead. You can choose the colors in col manually, by algorithm, or choose them randomly:

list = Symbol /@ CharacterRange["a", "n"];
cols = RandomChoice[{Red, Blue, Green, Black}, Length[list]];    
MapThread[Style[#1, #2] &, {list, cols}]
added 378 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

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]}]

enter image description here

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]}]

enter image description here

Since some of the comments seems to want to do this without the Table function, here's a way using MapThread that allows arbitrary specification of the colors in the list cols.

list = Symbol /@ CharacterRange["a", "n"];
cols = {Red, Green, Blue, Red, Green, Blue, Red, Red, Black, Black, Black, Red, Red, Black};
MapThread[Style[#1, #2] &, {list, cols}]

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]}]

enter image description here

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]}]

enter image description here

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]}]

enter image description here

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]}]

enter image description here

Since some of the comments seems to want to do this without the Table function, here's a way using MapThread that allows arbitrary specification of the colors in the list cols.

list = Symbol /@ CharacterRange["a", "n"];
cols = {Red, Green, Blue, Red, Green, Blue, Red, Red, Black, Black, Black, Red, Red, Black};
MapThread[Style[#1, #2] &, {list, cols}]
added 374 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198

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]}]

enter image description here

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]}]

enter image description here

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]}]

enter image description here

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]}]

enter image description here

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]}]

enter image description here

added 1 characters in body
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198
Loading
Source Link
bill s
  • 69.7k
  • 4
  • 103
  • 198
Loading