Pookkalam by Dhilshad P A

Code

cl=["#ffffff","#ffff19","#B31B1B","#FFDB49","#FF8C00","#66B032","purple","#DA1884","#e60000","#00ffff"]

def random_color():
    r = random(255)
    g = random(0)
    b = random(255)
    return color(r=r, g=g, b=b)

def c(r,cl,s):    
    c = circle(r=r,fill=cl,stroke=s)
    return c

def e(w, index,h,cr):
    n = index+1
    return ellipse(w=w, h=h, fill=cr ,stroke_width =1,stroke ='black') | repeat(n, rotate(180/n))

def r(h,w,cl,s):
    r = rectangle(h=h, w= w,fill=cl,stroke=s)
    return r

r1 = r(h=300, w= 300, cl=cl[0],s="black")
h2=133
r2 = r(h=148, w= 148, cl=cl[1],s=cl[5])| repeat (20,rotate(50))
r3 = r(h=h2, w= h2, cl=cl[6],s=cl[0])|rotate(15)| repeat (20,rotate(50))

c1=c(r=148,cl=cl[1],s="black")
c2=c(r=132,cl=cl[5],s=cl[7])
c3=c(r=105,cl=cl[2],s=cl[8])
c4=c(r=80,cl="#190066",s="orange")
c5=c(r=40,cl="black",s="none")

e1=e(294, 20,50,"#1a37d3")
e1e=e(294, 20,10,"#e00092")| rotate(30)
e2=e(264, 5,95,random_color())| rotate(45)
e3=e(264, 5,80,random_color())| rotate(45)
e4=e(264, 5,65,random_color())| rotate(45)
e5=e(264, 5,50,random_color())| rotate(45)
e6=e(264, 5,38,random_color())| rotate(45)
e7=e(264, 5,24,random_color())| rotate(45)
e8=e(264, 5,18,random_color())| rotate(45)
e9=e(264, 5,10,random_color())| rotate(45)
e10=e(264, 5,5,random_color())| rotate(45)
e20=e2+e3+e4+e5+e6+e7+e8+e9+e10
e21=e20| rotate(45)


shapes = [c]
NUM = 40
k=160
for i in range(NUM):
    shapes.append(ellipse(h=k/2,w=k,stroke="black") | rotate((360 / NUM) * i))
    
def bottomEllipse(x,y,w,h,fill):
    e = ellipse(x,y+h/2,w,h,fill=fill,stroke="none")
    return(e)

def petal(x,y,h,c1,c2,c3):
    p1=bottomEllipse(x,y,h/2,h,fill=c1)
    p2=bottomEllipse(x,y,h/3,h/1.5,fill=c2)
    p3=bottomEllipse(x,y,h/4,h/2,fill=c3)
    return(p1+p2+p3)

def flower(n,c1,c2):
    d = petal(0,n/4,n,c1,c2,c1)|repeat(8,rotate(45))
    c=circle(r=n/4,fill=c2,stroke="none")
    return(d+c)

d1=cl[0]
d2=cl[6]
f1 = flower(6,d1,d2)
f3 = f1| scale(1) | translate(y=33) | repeat(100, rotate(30) | scale(1)) 
f2 = f1| scale(1) | translate(y=33) | repeat(100, rotate(30) | scale(.96)) 
fl=f2+f3

pk=r1+c1+e1+e1e+c2+e20+e21+c3+r2+r3+c4
pc=c5+fl


show(pk)
show(*shapes)
show(pc)