A beautiful request! Here's a detailed SVG code for a colorful butterfly:
svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400">
<!-- Butterfly Body -->
<ellipse cx="200" cy="220" rx="10" ry="20" fill="#444" stroke="#333" stroke-width="1" />
<!-- Wings (4 parts: 2 upper, 2 lower) -->
<!-- Upper Wing Left -->
<path d="M 200,220 C 180,200 150,180 120,150
C 110,140 100,130 90,120
C 80,110 70,100 60,90
C 50,80 40,70 30,60
L 30,60 C 35,70 40,80 45,90
C 50,100 55,110 65,120
C 75,130 85,140 95,150
C 115,170 140,190 160,210
L 200,220 Z"
fill="#FF69B4" stroke="#FF3385" stroke-width="2" />
<!-- Upper Wing Right -->
<path d="M 200,220 C 220,200 250,180 280,150
C 290,140 300,130 310,120
C 320,110 330,100 340,90
C 350,80 360,70 370,60
L 370,60 C 365,70 360,80 355,90
C 350,100 345,110 335,120
C 325,130 315,140 305,150
C 285,170 260,190 240,210
L 200,220 Z"
fill="#FF69B4" stroke="#FF3385" stroke-width="2" />
<!-- Lower Wing Left -->
<path d="M 200,220 C 180,240 160,260 140,280
C 130,290 120,300 110,310
C 100,320 90,330 80,340
C 70,350 60,360 50,370
L 50,370 C 55,360 60,350 65,340
C 70,330 75,320 85,310
C 95,300 105,290 115,280
C 135,260 155,240 175,220
L 200,220 Z"
fill="#33CCFF" stroke="#00BFFF" stroke-width="2" />
<!-- Lower Wing Right -->
<path d="M 200,220 C 220,240 240,260 260,280
C 270,290 280,300 290,310
C 300,320 310,330 320,340
C 330,350 340,360 350,370
L 350,370 C 345,360 340,350 335,340
C 330,330 325,320 315,310
C 305,300 295,290 285,280
C 265,260 245,240 225,220
L 200,220 Z"
fill="#33CCFF" stroke="#00BFFF" stroke-width="2" />
<!-- Antennae -->
<line x1="200" y1="200" x2="180" y2="170" stroke="#333" stroke-width="3" />
<line x1="180" y1="170" x2="165" y2="160" stroke="#333" stroke-width="2" />
<line x1="200" y1="200" x2="220" y2="170" stroke="#333" stroke-width="3" />
<line x1="220" y1="170" x2="235" y2="160" stroke="#333" stroke-width="2" />
<!-- Eyes -->
<circle cx="195" cy="205" r="5" fill="#FFF" stroke="#333" stroke-width="1" />
<circle cx="205" cy="205" r="5" fill="#FFF" stroke="#333" stroke-width="1" />
<circle cx="195" cy="205" r="2" fill="#333" />
<circle cx="205" cy="205" r="2" fill="#333" />
<!-- Wing Patterns (dots) -->
<g fill="#FFF" stroke="#FFF" stroke-width="0.5">
<!-- Upper Wing Left Dots -->
<circle cx="120" cy="150" r="3" />
<circle cx="100" cy="130" r="3" />
<circle cx="80" cy="110" r="3" />
<circle cx="140" cy="170" r="3" />
<circle cx="160" cy="190" r="3" />
<!-- Upper Wing Right Dots -->
<circle cx="280" cy="150" r="3" />
<circle cx="300" cy="130" r="3" />
<circle cx="320" cy="110" r="3" />
<circle cx="260" cy="170" r="3" />
<circle cx="240" cy="190" r="3" />
<!-- Lower Wing Left Dots -->
<circle cx="140" cy="280" r="3" />
<circle cx="120" cy="300" r="3" />
<circle cx="100" cy="320" r="3" />
<circle cx="160" cy="260" r="3" />
<circle cx="180" cy="240" r="3" />
<!-- Lower Wing Right Dots -->
<circle cx="260" cy="280" r="3" />
<circle cx="280" cy="300" r="3" />
<circle cx="300" cy="320" r="3" />
<circle cx="240" cy="260" r="3" />
<circle cx="220" cy="240" r="3" />
</g>
</svg>
Let me explain what's going on in this code:
Overall Structure
The SVG has a viewBox of 0 0 400 400, which means the coordinate system is 400x400 units. The width and height attributes are set to 400 to display the SVG at its natural size.
Butterfly Body
The body is a simple ellipse with:
cx and cy attributes set to 200 and 220, respectively, which places the center of the ellipse at the middle-bottom of the SVG.
rx and ry attributes set to 10 and 20, respectively, which gives the ellipse a slightly elongated shape.
fill set to #444 (a dark gray) and stroke set to #333 (an even darker gray) with a stroke-width of 1.
Wings
The wings are made up of four path elements: two upper wings and two lower wings. Each wing is a symmetrical, curved shape with the following characteristics:
d attribute: a long string that defines the path's shape using cubic Bézier curves (C commands) and line commands (L).
fill and stroke attributes: each wing has a different color scheme:
Upper wings: #FF69B4 (pink) with a stroke of #FF3385 (deeper pink).
Lower wings: #33CCFF (light blue) with a stroke of #00BFFF (slightly darker blue).
stroke-width attribute: set to 2 for all wings.
Here's a breakdown of a single wing's d attribute (Upper Wing Left):
scss
M 200,220 // Move to the starting point (body center)
C 180,200 150,180 120,150 // Cubic Bézier curve (control points: 180,200; 150,180; end point: 120,150)
C 110,140 100,130 90,120 // Another cubic Bézier curve
...
L 30,60 // Line to the tip of the wing
C 35,70 40,80 45,90 // Curve back towards the body
...
L 200,220 Z // Close the path by returning to the starting point
Antennae
Two line elements create the antennae:
x1, y1 attributes set to 200 and 200 (the top of the body).
x2, y2 attributes set to 180 and 170 (for the left antenna) and 220 and 170 (for the right antenna).
stroke set to #333 (dark gray) with a stroke-width of 3 for the main antennae lines and 2 for the thinner tips.
Eyes
Two circle elements create the eyes:
cx and cy attributes set to 195 and 205 (left eye) and 205 and 205 (right eye).
r attribute set to 5 for the outer circle (white part of the eye).
fill set to #FFF (white) and stroke set to #333 (dark gray) with a stroke-width of 1.
A smaller circle ( r = 2 ) is placed on top of each eye with fill set to #333 (dark gray) to create the pupils.
Wing Patterns (dots)
A group (<g>) of circle elements creates the white dots on the wings:
fill set to #FFF (white) and stroke set to #FFF with a stroke-width of 0.5 (almost no stroke).
Each dot has a r attribute set to 3 and is placed at specific coordinates on the wings to create a random, organic pattern.
That's it! You should now have a beautiful, detailed SVG butterfly. You can adjust colors, sizes, and positions to your liking.
Tips:
To change the butterfly's size, simply adjust the width and height attributes of the SVG element.
To animate the wings, you can add CSS animations or JavaScript event listeners to modify the transform attribute of each wing path (e.g., rotate, scale, or translate).
Experiment with different colors, gradients, or textures to give your butterfly a unique look.