Truchet tiles are patterned tiles that join together to form new patterns. I implemented an interactive, randomly generated square Truchet tiling with p5.js. Clicking on a tile rotates it, and double-clicking changes the type of tile. 
Connected segments of the pattern are colored, and the colors are updated every time a tile changes. I used triad matching to generate a color palette.
See links to the code and a demo below