A sleek and user-friendly tool to create beautiful CSS gradients with a live preview and instantly copyable code.
- Features
- Installation
- Usage
- Keyboard Shortcuts
- Export Formats
- Browser Support
- Troubleshooting
- Contributing
- License
- Developer and Maintainer
You can use the tool directly here: https://turborx.github.io/CSS-Gradient-Generator/
To verify all functionality works correctly, visit: test.html
- Live gradient preview with real-time updates
- Multiple gradient types: Linear, Radial, Conic, and Repeating variants
- Drag & drop color stops with dynamic positioning
- Dark and light theme toggle with system preference detection
- Random gradient generator for inspiration
- Undo/Redo functionality with complete history
- Multiple export formats: CSS, SCSS, JSON, SVG
- Copy-to-clipboard functionality
- Share gradients via URL
- Preset gradients collection
- Keyboard shortcuts for power users
- Fully accessible with ARIA support
- Mobile responsive design
Simply visit the live website - no installation required!
-
Clone the repository:
git clone https://github.com/TurboRx/CSS-Gradient-Generator.git cd CSS-Gradient-Generator -
Serve the files (required for proper functionality):
# Using Python 3 python -m http.server 8000 # Using Node.js (npx) npx serve . # Using PHP php -S localhost:8000
-
Open in browser: Navigate to
http://localhost:8000 -
Run tests: Visit
http://localhost:8000/test.htmlto verify everything works
- Select Gradient Type: Choose from Linear, Radial, or Conic gradients
- Adjust Parameters: Modify angle, shape, size, and position as needed
- Manage Colors: Add, remove, or modify color stops
- Preview Live: See real-time updates in the preview area
- Export: Copy CSS code or download in various formats
- Share: Generate shareable URLs for your gradients
- Preset Gradients: Click any preset to apply instantly
- Random Generation: Use the "Random Design" button for inspiration
- Undo/Redo: Use buttons or keyboard shortcuts to navigate history
- Theme Toggle: Switch between light and dark modes
| Shortcut | Action |
|---|---|
Ctrl/Cmd + C |
Copy gradient code |
Ctrl/Cmd + Z |
Undo last action |
Ctrl/Cmd + Shift + Z |
Redo action |
Ctrl/Cmd + Y |
Redo action (alternative) |
Ctrl/Cmd + R |
Generate random gradient |
Escape |
Clear focus |
background-image: linear-gradient(45deg, #ff0000, #0000ff);$gradient: linear-gradient(45deg, #ff0000, #0000ff);
background-image: $gradient;{
"type": "linear-gradient",
"angle": 45,
"colors": [
{"color": "#ff0000", "position": null},
{"color": "#0000ff", "position": null}
],
"css": "linear-gradient(45deg, #ff0000, #0000ff)"
}<svg width="400" height="300" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#ff0000" />
<stop offset="100%" style="stop-color:#0000ff" />
</linearGradient>
</defs>
<rect width="100%" height="100%" fill="url(#grad)" />
</svg>- Chrome: 88+ β
- Firefox: 85+ β
- Safari: 14+ β
- Edge: 88+ β
- Mobile browsers: iOS Safari 14+, Chrome Mobile 88+ β
- CSS Gradients: All modern browsers
- Material Icons: Loaded via Google Fonts API
- Clipboard API: HTTPS required for full functionality
- File Download: All modern browsers
Symptoms: Icons appear as text or squares
Solutions:
- Ensure internet connection for Google Fonts
- Check if Content Security Policy blocks external fonts
- Try refreshing the page
- Verify the page is served over HTTP/HTTPS (not
file://)
Symptoms: Copy button doesn't work
Solutions:
- Ensure page is served over HTTPS (required for Clipboard API)
- Use a local server for development (see installation instructions)
- Try manual copy from the text area
Symptoms: Changes don't reflect in preview
Solutions:
- Check browser console for JavaScript errors
- Ensure all script files are loaded correctly
- Try refreshing the page
- Verify no browser extensions are interfering
Symptoms: Dark/Light mode buttons don't respond
Solutions:
- Check that JavaScript is enabled
- Verify theme buttons exist in the DOM
- Clear browser cache and reload
- Check for console errors
Symptoms: Download button doesn't create file
Solutions:
- Check browser's download settings
- Ensure pop-ups aren't blocked
- Try a different export format
- Verify JavaScript is enabled
To enable debug mode, open browser console and run:
localStorage.setItem('gradient-debug', 'true');
location.reload();This will enable detailed logging to help diagnose issues.
- Visit
test.htmlin your browser - Review the test results
- Address any failed tests
- Green checkmarks = everything is working!
If you encounter issues:
- Check the test page: Visit
test.htmlfirst - Review console errors: Open browser DevTools (F12)
- Try different browsers: Test in Chrome, Firefox, Safari
- Check network: Ensure internet access for external resources
- Create an issue: Report bugs on the Issues page
Contributions are welcome! Here's how to contribute:
- Fork the repository
- Clone your fork:
git clone https://github.com/YourUsername/CSS-Gradient-Generator.git
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Test your changes with
test.html - Commit your changes:
git add . git commit -m "Add your descriptive message"
- Push to your fork:
git push origin feature/your-feature-name
- Create a Pull Request
- Test thoroughly: Run
test.htmlbefore submitting - Follow conventions: Match existing code style
- Document changes: Update README if needed
- Consider accessibility: Maintain ARIA compliance
- Mobile-first: Ensure responsive design
- Performance: Optimize for fast loading
When reporting bugs:
- Use test.html: Include test results
- Browser info: Specify browser and version
- Steps to reproduce: Clear reproduction steps
- Expected vs actual: What should happen vs what does happen
- Console errors: Include any error messages
This project is licensed under the MIT License. Feel free to use, modify, and distribute as needed.
Made with β€οΈ for the web development community
TurboRx - GitHub Profile
- π Issues: Report bugs or request features
- π Star: Show your support by starring the repository
- π΄ Fork: Create your own version