Code
COLORS = [
"#000000", "#FFFFFF", "#FF0000", "#00FF00", "#0000FF", "#FFFF00",
"#00FFFF", "#FF00FF", "#C0C0C0", "#808080", "#800000", "#808000",
"#008000", "#800080", "#008080", "#000080", "#800000", "#8B0000",
"#A52A2A", "#B22222", "#DC143C", "#FF0000", "#FF6347", "#FF7F50",
"#CD5C5C", "#F08080", "#E9967A", "#FA8072", "#FFA07A", "#FF4500",
"#FF8C00", "#FFA500", "#FFD700", "#B8860B", "#DAA520", "#EEE8AA",
"#BDB76B", "#F0E68C", "#808000", "#FFFF00", "#9ACD32", "#556B2F"]
rect = rectangle(w=300,h=300, fill="black")
def genSphere(n=80, r=230, g=20, b=20):
step = 1/n
cir = circle(r=0)
for i in range(n):
val = step * (i + 1)
sVal = max(pow(val, 0.25), 0.1)
clr = color(r * sVal, g * sVal , b * sVal)
cir += circle(r=100, fill=clr, stroke=clr) | scale(1 - val)
return cir
def genRings():
cir = circle(r=0)
for i in range(40):
cir += circle(r=140-i, stroke=COLORS[i])
return cir
star = circle(r=2, x=-130, y=120, fill="white")
star2 = circle(r=2, x=130, y=120, fill="white")
star2 += circle(r=2, x=20, y=90, fill="white")
star2 += circle(r=2, x=130, y=-130, fill="white")
star2 += circle(r=2, x=-130, y=-110, fill="white")
stars = star + star2
sphere = genSphere(r=210, g=181, b=91) | scale(0.8)
rings = genRings() | scale(y=0.6) | translate(y=-20)
show(rect + rings + sphere + stars)