A minimal, elegant website template featuring an animated floating dots background with automatic theme switching. Built with pure vanilla JavaScript and CSS.
Experience the animated particle background and theme switching in action!
- Animated Particle Background - Floating dots that connect and move gracefully
- Automatic Theme Detection - Adapts to your system's light/dark mode preference
- Fully Responsive - Works perfectly on all devices and screen sizes
- Zero Dependencies - Pure vanilla JavaScript and CSS
- Smooth Animations - CSS transitions and requestAnimationFrame for buttery smoothness
- Minimal Design - Clean, distraction-free interface
- Download the files - Clone or download this repository
- Open in your browser - Simply open
index.htmlin your web browser - That's it! No installation or dependencies needed
# Using Python
python -m http.server 8000
# Using PHP
php -S localhost:8000
# Using Node.js (if you have it)
npx http-serverThen visit http://localhost:8000 in your browser.
Edit the CSS custom properties in styles.css:
:root {
--bg-primary: #000000;
--text-primary: #ffffff;
--shadow-color: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] {
--bg-primary: #ffffff;
--text-primary: #000000;
--shadow-color: rgba(0, 0, 0, 0.1);
}Modify the particle behavior in background.js:
// Number of dots (fewer for mobile)
const dotCount = window.innerWidth < 768 ? 80 : 120;
// Dot movement speed
vx: (Math.random() - 0.5) * 0.5,
vy: (Math.random() - 0.5) * 0.5,
// Connection distance
if (dist < 10000) { // Adjust this valueCustomize the theme toggle button in styles.css:
.theme-toggle {
width: 80px;
height: 80px;
font-size: 2rem;
/* Add your custom styles */
}particletheme/
├── index.html # Main HTML file
├── styles.css # All styling and animations
├── theme.js # Theme switching logic
├── background.js # Particle animation system
├── LICENSE # Creative Commons BY 4.0
└── README.md # Project documentation
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the Creative Commons Attribution 4.0 International License - see the LICENSE file for details.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially
Under the following terms:
- Attribution — You must give appropriate credit to davidalvarezp, provide a link to the license, and indicate if changes were made.
davidalvarezp
- Website: davidalvarezp.com
- GitHub: @davidalvarezp
- Google Fonts for the Inter typeface
- Creative Commons for the open license
- The web development community for inspiration