Cut every hexagon of a grid into six kites, from its center to the middle of each side. Each kite has angles of 60°, 90°, 120° and 90°. The hat is eight of these kites stuck together: four from one hexagon and two from each of two others, a color for each.
The source code is at github.com/KirillOsenkov/LiveGeometry. It is written in .NET and Avalonia.