This is a simple weather application that displays real-time weather information for any city using the OpenWeather API. Users can input the name of a city and get the current temperature, humidity, weather description, and an icon representing the current weather conditions.
- 🌡️ Current Temperature: Displays the current temperature for the selected city.
- 💧 Humidity: Shows the current humidity level of the city.
- ☁️ Weather Description: Provides a description of the current weather conditions (e.g., clear sky, scattered clouds).
- 🎨 Dynamic Background Color: Changes the background color based on the weather condition (e.g., blue for cloudy, yellow for sunny).
- ☀️ Weather Icons: Shows a matching icon for the weather condition.
- HTML
- CSS
- JavaScript
- OpenWeather API
-
Clone this repository:
git clone https://github.com/dorukhanbekdur/live-weather-app.git
-
Clone this repository:
cd live-weather-app
-
Open
index.html
in your browser: -
Enter the name of a city in the input field and click the "Get Weather" button to see the current weather information.:
live-weather-app/
├── index.html # Main HTML file that structures the app interface
├── style.css # CSS file for styling the weather card and background
├── script.js # JavaScript file to fetch and display weather data
└── README.md # Documentation file explaining the app
To fetch weather data from the OpenWeather API, you need an API key. Follow these steps to set it up:
-
Create an OpenWeather Account:
- Go to the OpenWeather website and sign up for a free account.
-
Generate an API Key:
- Once you’re logged in, navigate to the "API keys" section in your account settings.
- Generate a new API key and copy it.
-
Add Your API Key to the Project:
- Open the
script.js
file in your project. - Locate the following line in the file:
const apiKey = 'YOUR_API_KEY';
- Replace
'YOUR_API_KEY'
with the API key you copied from OpenWeather:const apiKey = 'your_actual_api_key_here';
- Open the
-
Save and Run:
- Save the changes to
script.js
. - Now you’re ready to fetch live weather data! Enter a city name in the app and click "Get Weather" to see the results.
- Save the changes to
Note: Be sure to keep your API key secure. Avoid sharing it publicly or including it in repositories without protecting it.