# How to make a hexagon tiling?

I want to make a hexagonal tiling using random colors for each tile. And I am trying make a readable way of doing it.

Here is how to make a hexagonal tiling with a random color (specifically on the blue or pink spectrums):

hexes2 = Keys[
ResourceFunction["HextileBins"][
Flatten[Table[{x, y}, {x, 0, 12}, {y, 0, 12}], 1], 2]];
Graphics[{EdgeForm[Blue], FaceForm[RandomColor[]], hexes2}]


But I want to use these prior commands:

PinkSpectrum =Table[(1 - t) *{255,0,127} + t*{255, 255, 255},{t,0,1,.0001}];
BlueSpectrum = Table[(1 - t) *{0, 0, 255}+ t*{255, 255, 255},{t,0,1,.0001}];

Table[Graphics[{RGBColor[RandomChoice[Join[BlueSpectrum, PinkSpectrum]]/255], RegularPolygon[.5,6]}],{n,1,20}]


to make a hexagonal tiling where each tile has a random color. So the entire tiling is not the same color. I do not care if like colors are adjacent or not.

• Have a look at ResourceFunction["HextileBins"] in the application section. You could do something like: hexes = Keys@ResourceFunction["HextileBins"][ Flatten[Table[{x, y}, {x, 0, 10}, {y, 0, 5}], 1], 2]; Graphics[Riffle[RandomColor[Length[hexes]], hexes]] Jan 7 at 0:37

If you replace your final line with:

Graphics[{EdgeForm[Blue], FaceForm[RandomColor[]], hexes2[[#]]}
& /@ Range[Length[hexes2]]]


you get different colors for each hex. The problem with your version is that Graphics sees {Edgeform, FaceForm, all 56 hexes}. The version here sees {Edgeform, FaceForm, hex #1}, {Edgeform, FaceForm, hex #2}, {Edgeform, FaceForm, hex #3}... etc.

To constrain the randomness of the color using your Pink and Blue spectrum commands, change this to:

Graphics[{EdgeForm[Blue],
FaceForm[RGBColor[RandomChoice[Join[BlueSpectrum, PinkSpectrum]]/255]],
hexes2[[#]]} & /@ Range[Length[hexes2]]] 