PixelPulse is an innovative web application that dynamically generates color schemes based on real-time weather conditions. By combining weather data with color theory, it creates visually appealing and contextually relevant color palettes that reflect the current weather state of any location worldwide.
-
Real-time Weather Integration
- Automatic location detection using browser geolocation
- City-based weather search functionality
- Current temperature, humidity, and weather condition display
- Weather condition icons and descriptions
-
Dynamic Color Generation
- Weather-based color palette generation
- Temperature-influenced color adjustments
- Predefined color mappings for different weather conditions
- Copy-to-clipboard functionality for color codes
-
Responsive Design
- Mobile-first approach
- Fluid layouts using Chakra UI
- Intuitive user interface
- Smooth animations and transitions
- React 18 - UI library
- TypeScript - Type safety and better developer experience
- Vite - Build tool and development server
- Chakra UI - Component library and styling
- Chroma.js - Color manipulation and generation
- Axios - HTTP client for API requests
- OpenWeatherMap API - Weather data provider
src/
βββ components/ # React components
β βββ SearchBar.tsx # City search functionality
β βββ WeatherDisplay.tsx # Weather information display
β βββ ColorSchemeDisplay.tsx # Color palette display
βββ services/ # Business logic and API calls
β βββ weatherService.ts # Weather API integration
β βββ colorService.ts # Color generation logic
βββ types/ # TypeScript type definitions
β βββ weather.ts # Weather and color scheme types
βββ App.tsx # Main application component
βββ main.tsx # Application entry point
- Node.js (v16 or higher)
- npm or yarn package manager
- OpenWeatherMap API key
-
Clone the repository:
git clone https://github.com/yourusername/WeatherColorPicker.git cd WeatherColorPicker
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory:VITE_OPENWEATHER_API_KEY=your_api_key_here
-
Start the development server:
npm run dev
-
Build for production:
npm run build
The application uses a sophisticated color generation system based on:
- Weather Conditions: Each weather type (Clear, Rain, Snow, etc.) has predefined base colors
- Temperature: Colors are adjusted based on temperature (warmer/cooler)
- Color Scheme Generation: Creates a complete palette including:
- Primary color
- Secondary color
- Accent color
- Background color
- Text color
const weatherColorMap = {
Clear: ['#FFD700', '#FFA500'], // Sunny, warm colors
Clouds: ['#B8B8B8', '#E8E8E8'], // Grey, neutral colors
Rain: ['#4682B4', '#87CEEB'], // Blue, water colors
Snow: ['#FFFFFF', '#F0F8FF'], // White, light blue
Thunderstorm: ['#483D8B', '#4B0082'], // Dark, intense colors
Drizzle: ['#87CEEB', '#B0E0E6'], // Light blue, peaceful colors
Mist: ['#D3D3D3', '#F5F5F5'] // Light grey, foggy colors
};
The application uses OpenWeatherMap API to fetch weather data:
- Current weather conditions
- Temperature in Celsius
- Humidity percentage
- Weather descriptions
- Weather icons
Example API response structure:
interface WeatherData {
main: {
temp: number;
humidity: number;
feels_like: number;
};
weather: Array<{
main: string;
description: string;
icon: string;
}>;
name: string;
}
- 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
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenWeatherMap API for weather data
- Chroma.js for color manipulation
- Chakra UI for the component library
- The React community for inspiration and support