A modern, responsive weather application that provides current weather conditions and 5-day forecasts for any city. Built with JavaScript, HTML, and CSS.
-
Real-time Weather Data
- Current temperature and conditions
- Humidity and wind speed
- 5-day weather forecast
- Weather-based background images
-
User Interface
- Clean and responsive design
- Dark/Light mode toggle
- Temperature unit toggle (Celsius/Fahrenheit)
- Location-based weather detection
- Search by city name
-
Additional Features
- Dynamic weather icons
- Error handling for invalid cities
- Loading animations
- Persistent dark mode preference
- HTML5
- CSS3
- JavaScript (ES6+)
- OpenWeather API
- Font Awesome Icons
-
Clone the repository:
-
Navigate to the project directory:
-
Create an
images
folder and add the following weather background images:
- clear-day.png
- clear-night.png
- cloudy.png
- rainy.png
- thunderstorm.png
- snow.png
- mist.png
- Open
index.html
in your browser or use a local server:
The app uses the OpenWeather API. The API key is already included in the code, but for your own deployment, you should:
- Sign up at OpenWeather
- Get your API key
- Replace the API key in
script.js
:
-
Search for a City
- Type a city name in the search box
- Press Enter or click the search icon
-
Use Current Location
- Click the location icon to get weather for your current location
- Allow location access when prompted
-
Toggle Temperature Unit
- Click the "Switch to °F/°C" button to change temperature units
-
Dark Mode
- Click the sun/moon icon in the top-right corner to toggle dark mode
- City name and country
- Current temperature
- Weather description
- Humidity percentage
- Wind speed
- Weather condition icon
- Date and day of the week
- Weather icon
- Maximum and minimum temperatures
- Weather description
- Humidity and wind speed
The background image changes based on weather conditions:
- Clear sky
- Cloudy
- Rainy
- Thunderstorm
- Snow
- Mist
- Fork the repository
- 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