o1-preview-2024-09-12· OpenAI
WildChat-4.8M (AI2)
Draw me a home icon in SVG
- User
Draw me a home icon in SVG
- Assistant
Certainly! Here's an SVG code for a simple home icon:
svg
Draw me a home icon in SVG
Certainly! Here's an SVG code for a simple home icon:
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<!-- Draw the base of the house -->
<rect x="25" y="50" width="50" height="40" fill="#8ED6FF" stroke="#000" stroke-width="2"/>
<!-- Draw the roof of the house -->
<polygon points="50,20 20,50 80,50" fill="#00A1E0" stroke="#000" stroke-width="2"/>
</svg>
Explanation:
<svg> element: Defines the SVG canvas with a width and height of 100 pixels.
House Base (<rect>):
x="25" and y="50" position the rectangle 25 pixels from the left and 50 pixels from the top.width="50" and height="40" create a rectangle 50 pixels wide and 40 pixels tall.fill="#8ED6FF" sets the fill color to a light blue.stroke="#000" outlines the rectangle with black color.stroke-width="2" sets the outline thickness to 2 pixels.Roof (<polygon>):
points="50,20 20,50 80,50" defines a triangle by specifying the x and y coordinates of its three corners.
50,20 is the peak of the roof.20,50 and 80,50 are the bottom left and right corners aligning with the top of the house base.fill="#00A1E0" sets the fill color to a darker blue.stroke="#000" and stroke-width="2" outline the roof similarly to the house base.How to Use:
Copy the Code: Select the SVG code above and copy it to your clipboard.
Create an SVG File:
Save the File:
.svg extension, for example, home_icon.svg.View the Icon:
Customization:
fill and stroke attributes to customize colors.width and height in the <svg> tag and corresponding shapes to scale the icon.stroke-width to change the thickness of the outlines.Feel free to adjust the code to suit your design needs!
Not yet included in a published release.