Pookkalam by Sree XD

Code

def draw(rad, off, fill, stroke, rotoff, count, tx, ty, s):
    c = circle(r=rad, x=-rad-off, y=rad+off, fill=fill, stroke=stroke) | rotate(rotoff) | repeat(count, rotate(360 / count)) | translate(tx, ty) | scale(s)
    r = rectangle(h=rad, w=rad, x=-1.5*rad-off, y=1.5*rad+off, fill=fill, stroke=stroke) | rotate(rotoff) | repeat(count, rotate(360 / count)) | translate(tx, ty) | scale(s)
    return c, r 

def draw_flower(s, px, py, rot1, rot2, rot3, inner_bg, outer1, outer2, mid1, mid2, inner1, inner2, inner_c):
    # inner bg
    c0 = circle(r=25, fill=inner_bg, stroke=inner_bg) | translate(px, py) | scale(s)
    # outer
    c1, r1 = draw(36, 20, outer1, outer1, rot1, 5, px, py, s) 
    c11, r11 = draw(32, 19, outer2, outer2, rot1, 5, px, py, s) 
    # mid
    c2, r2 = draw(32, 11, mid1, mid1, rot2, 5, px, py, s)
    c21, r21 = draw(28, 11, mid2, mid2, rot2, 5, px, py, s)
    # inner
    c3, r3 = draw(24, 5, inner1, inner1, rot1, 5, px, py, s)
    c31, r31 = draw(19, 5, inner2, inner2, rot1, 5, px, py, s)
    # inner core
    c4, r4 = draw(3, 2, inner_c, inner_c, rot3, 5, px, py, s)
    return [c0, c1, r1, c11, r11, r2, c2, r2, c21, r21, c3, r3, c31, r31, c4, r4]

def draw_flower2(s, px, py, rot1, rot3, inner_bg, inner1, inner2, inner_c):
    # inner bg
    c0 = circle(r=25, fill=inner_bg, stroke=inner_bg) | translate(px, py) | scale(s)
    # inner
    c3, r3 = draw(24, 5, inner1, inner1, rot1, 5, px, py, s)
    c31, r31 = draw(19, 5, inner2, inner2, rot1, 5, px, py, s)
    # inner core
    c4, r4 = draw(4, 3, inner_c, inner_c, rot3, 5, px, py, s)
    return [c0, c3, r3, c31, r31, c4, r4]
    
l = draw_flower(s=0.26,
    px = 410,
    py = 220,
    rot1 = -105,
    rot2 = -70,
    rot3 = -70,
    inner_bg='#ff1f4b',
    outer1 = '#f73e59',
    outer2 = '#fa5c75',
    mid1 = '#fc2b54',
    mid2 = '#ff385f',
    inner1 = '#fc1240',
    inner2 = '#fc2852',
    inner_c = '#e00024'
);

l.extend(draw_flower(s=0.26,
    px = -430,
    py = 90,
    rot1 = 100,
    rot2 = 65,
    rot3 = 110,
    inner_bg='#a536ff',
    outer1 = '#b75eff',
    outer2 = '#c175ff',
    mid1 = '#aa40ff',
    mid2 = '#b252ff',
    inner1 = '#9d26ff',
    inner2 = '#a940ff',
    inner_c = '#7c00e0'
));

l.extend(draw_flower(s=0.26,
    px = -60,
    py = 430,
    rot1 = 105,
    rot2 = -5,
    rot3 = 110,
    inner_bg='#6ddeed',
    outer1 = '#80e5f2',
    outer2 = '#9ff2fc',
    mid1 = '#63d6e6',
    mid2 = '#77e9f7',
    inner1 = '#55c9d9',
    inner2 = '#6fe3f2',
    inner_c = '#29a9ba'
));

l.extend(draw_flower(s=0.26,
    px = 350,
    py = -355,
    rot1 = 110,
    rot2 = 75,
    rot3 = 110,
    inner_bg='#ffd445',
    outer1 = '#fcc36d',
    outer2 = '#fcdb6d',
    mid1 = '#ffac54',
    mid2 = '#ffcf54',
    inner1 = '#ffa04d',
    inner2 = '#ffd445',
    inner_c = '#de771f'
));

l.extend(draw_flower(s=0.26,
    px = -245,
    py = -410,
    rot1 = -115,
    rot2 = 65,
    rot3 = 110,
    inner_bg='#36f589',
    outer1 = '#50e692',
    outer2 = '#63ffa7',
    mid1 = '#35de81',
    mid2 = '#45f592',
    inner1 = '#13d47d',
    inner2 = '#32f085',
    inner_c = '#03a35c'
));

l.extend(draw_flower(s=0.525,
    px = 0,
    py = 0,
    rot1 = 0,
    rot2 = 35,
    rot3 = 0,
    inner_bg='#ffebf5',
    outer1 = '#d1c1f7',
    outer2 = '#f4ebff',
    mid1 = '#e6bbf2',
    mid2 = '#f9ebfc',
    inner1 = '#f7bedb',
    inner2 = '#ffebf5',
    inner_c = '#e895c3'
));

l.extend(draw_flower2(s=0.22,
    px = 470,
    py = -100,
    rot1 = 20,
    rot3 = 0,
    inner_bg='#fccdc2',
    inner1 = '#e0aa9d',
    inner2 = '#fccdc2',
    inner_c = '#c4897a'
));

l.extend(draw_flower2(s=0.22,
    px = 225,
    py = 450,
    rot1 = 0,
    rot3 = 0,
    inner_bg='#dee2ff',
    inner1 = '#c0caf0',
    inner2 = '#dee2ff',
    inner_c = '#929ad4'
));

l.extend(draw_flower2(s=0.22,
    px = -345,
    py = 385,
    rot1 = 15,
    rot3 = 0,
    inner_bg='#f2d4ff',
    inner1 = '#d2afe0',
    inner2 = '#f2d4ff',
    inner_c = '#b88dc9'
));

l.extend(draw_flower2(s=0.22,
    px = -440,
    py = -220,
    rot1 = 35,
    rot3 = 0,
    inner_bg='#d6ffde',
    inner1 = '#9fd6a9',
    inner2 = '#d6ffde',
    inner_c = '#80bd8c'
));

l.extend(draw_flower2(s=0.22,
    px = 70,
    py = -510,
    rot1 = 0,
    rot3 = 0,
    inner_bg='#fffcc9',
    inner1 = '#facd89',
    inner2 = '#fffcc9',
    inner_c = '#d9ad6a'
));

c, r = draw(3, 49, '#c9b5eb', '#c9b5eb', 0, 5, 0, 0, 1) 
c2, r2 = draw(30, 7, '#d2f4f4', '#d2f4f4', 0, 5, 0, 0, 1) 
c3, r3 = draw(45, 8, '#d7f7f7', '#d7f7f7', 0, 5, 0, 0, 1) 
c4, r4 = draw(53, 10, '#e1fcfc', '#e1fcfc', 0, 5, 0, 0, 1) 
r5 = rectangle(h=300, w=300, fill='#effdfd', stroke='#f0ffff')

show(r5, c4, r4, c3, r3, c2, r2, *l, c, r)