A versatile web tool for generating various SVG shapes (Polygons, Stars, Circles, Ellipses, Rectangles, Lines) with customizable parameters and live preview. ✨
- 🎨 Multiple Shape Types: Generate:
- Polygons (Regular)
- Stars
- Circles
- Ellipses
- Rectangles
- Rounded Rectangles
- Lines
- 🎛️ Customizable Parameters: Adjust shape-specific properties:
- Points/Sides (Polygon, Star)
- Outer Radius (Polygon, Star)
- Inner Radius (Star)
- Radius (Circle)
- Radius X/Y (Ellipse)
- Width/Height (Rectangle)
- Corner Radius RX/RY (Rounded Rectangle)
- Start/End Coordinates (Line)
- Center Coordinates (Circle, Ellipse)
- Top-Left Coordinates (Rectangle)
- 🎨 Appearance Controls:
- Fill Color (Not applicable for Line)
- Stroke Color
- Stroke Width
- 👁️ Live Preview: See the generated SVG shape update instantly as you change parameters.
- 💻 Code Generation: Displays the complete, formatted SVG code for the generated shape.
- 🖱️ Click-to-Copy: Easily copy the generated SVG code.
- 📱 Responsive Design: Basic responsive layout.
- 💬 User Feedback: Displays messages for success (e.g., "SVG code copied!") or errors.
- Clone this repository or download the
index.html
file. - Open
index.html
in your web browser. - Select the desired Shape Type from the dropdown menu.
- The relevant controls for the selected shape will appear.
- Adjust the sliders and color pickers to customize the shape and its appearance.
- The Preview area will update in real-time. 🔥
- The Generated SVG Code box shows the code for the current shape.
- Click the Copy SVG Code button to copy the code to your clipboard. 📋
- HTML: Page structure and controls.
- CSS (Tailwind CSS): Styling & layout (via CDN).
- JavaScript:
- Handles user input from sliders, dropdowns, and color pickers.
- Calculates shape geometry (points, coordinates, radii).
- Dynamically generates SVG element strings.
- Updates the live preview and code output areas.
- Manages control visibility based on selected shape type.
- Implements copy-to-clipboard functionality.
Contributions are welcome! 🎉 Whether it's bug fixes, adding new shapes, improving the UI, or enhancing features, please feel free to contribute.
How to Contribute:
- Fork the Repository: Click the 'Fork' button.
- Clone Your Fork:
- Create a New Branch:
git checkout -b feature/add-path-shape # or git checkout -b fix/star-calculation-bug
- Make Your Changes.
- Test Your Changes.
- Commit Your Changes (Consider Conventional Commits):
git add . git commit -m "feat: Add support for SVG <path> element" # or git commit -m "fix: Correct inner radius calculation for stars"
- Push to Your Fork:
git push origin feature/add-path-shape
- Open a Pull Request (PR): Go to the original repository and open a PR.
- Provide a clear title and description.
- Link any relevant issues.
Reporting Bugs:
- Use the GitHub Issues tab.
- Provide a clear title, description, and steps to reproduce.
Suggesting Enhancements:
- Use the GitHub Issues tab.
- Provide a clear title and detailed description.
- More Shapes: Add support for
<path>
elements (e.g., arcs, curves),<text>
, or more complex predefined shapes. - Transformations: Add controls for
rotate
,scale
,skew
transformations. - Gradients/Patterns: Allow using gradients or patterns for fills/strokes.
- ViewBox Control: Allow users to adjust the SVG
viewBox
. - Export Options: Add options to download the generated SVG as a
.svg
file. - Code Formatting Options: Allow choosing different SVG code formatting styles.
- UI/UX: Improve slider precision, add input fields for exact values, enhance visual design.
Happy Generating! 📐