Pookkalam by Rohit V

Code

from math import sqrt
# Hexagon generator
def hex(size:float,color:str):
    return polygon([
        point(0, 0), 
        point(size, 0), 
        point(size/2, sqrt(3)*size/2), 
        point(0, 0)], 
        stroke=color, 
        fill=color) \
        | rotate(30) | repeat(6, rotate(60))

# A plain square to hide axes
base_layer = rectangle(h=300, w=300, fill="white", stroke="white")

# Sharp corners
back_layer = combine([
    rectangle(h=210, w=210, fill="red", stroke="white") +  
    rectangle(h=200, w=200,fill="orange", stroke="white") + 
    rectangle(h=190, w=190, fill="yellow", stroke="white") + 
    rectangle(h=180, w=180, fill="white", stroke="white") 
    | repeat(4, rotate(22.5)),
    circle(r=125, fill="white", stroke="white"), # Circle clips the rectangles, makes it look like corners
    ])

# Flower like pattern in the background
ellipse_layer = combine([
    ellipse(h=20, w=150, x=45, fill="#542E71", stroke="transparent") | rotate(0) | repeat(12, rotate(30)),
    ellipse(h=20, w=150, x=45, fill="#FB3640", stroke="transparent") | rotate(3) | repeat(12, rotate(30)),
    ellipse(h=20, w=150, x=45, fill="#FDCA40", stroke="transparent") | rotate(6) | repeat(12, rotate(30)),
    ellipse(h=20, w=150, x=45, fill="#A799B7", stroke="transparent") | rotate(9) | repeat(12, rotate(30)),
    ]) \
    | repeat(2, rotate(15)) | repeat(10, scale(0.95) | rotate(10))

# Hexagons
hex_layer = combine([
    hex(100, "#900C3F"),
    hex(80, "#C70039"),
    hex(60, "#FF5733"), 
    hex(40, "#FFC300"),
    hex(20, "#ffffff")
    ])


# Weird purple-ish flower pattern
flower_layer = combine([
    ellipse(h=20, w=100, x=45, fill="#000044",stroke="transparent"),
    ellipse(h=15, w=80, x=35, fill="#52057B",stroke="transparent") ,
    ellipse(h=10, w=60, x=25, fill="#892CDC",stroke="transparent") ,
    ellipse(h=5, w=40, x=15, fill="#BC6FF1",stroke="transparent"),
     ]) \
    | repeat(6, rotate(60)) | rotate(30) | repeat(10, scale(0.8) | rotate(-10)) 


# Simple white circle at the top
topping_layer = circle(r=5, fill="white", stroke="white")


show(
    base_layer,
    back_layer,
    ellipse_layer,
    hex_layer,
    flower_layer,
    topping_layer,
    )