A revolutionary CSS/JavaScript system that creates real-time, environment-based theming for websites. World.CSS automatically adjusts colors based on your location, time of day, weather conditions, and solar position to create truly living, ambient themes.
Works with any web technology - React, Vue, Angular, Node.js, Python, Ruby, .NET, or plain HTML!
- Solar-based colors that change throughout the day
- Weather integration with OpenWeatherMap API
- Geolocation detection for accurate local conditions
- Smooth transitions between different times of day
- Automatic updates every 5 minutes
- π Night (-6Β° and below) - Deep indigo with subtle highlights
- π Twilight (-6Β° to -3Β°) - Purple gradients with soft lighting
- π Sunrise (-3Β° to 5Β°) - Warm oranges and yellows
- βοΈ Day (5Β° to 20Β°) - Bright, vibrant daylight colors
- π Noon (20Β° to 45Β°) - Intense blue sky and bright accents
- π Sunset (45Β° to 70Β°) - Rich oranges and warm tones
- π Evening (70Β° to 100Β°) - Deep purples and evening atmosphere
- HSL Color Model for smooth color interpolation
- WCAG Compliant contrast ratios for accessibility
- Manual Override Modes (Auto/Light/Dark)
- Customizable Configuration via
world-config.js
- Responsive Design that works on all devices
- Professional UI Components with glassmorphism effects
- Web server (Apache, Nginx, etc.)
- Backend API (PHP, Node.js, Python, Ruby, .NET, etc.)
- OpenWeatherMap API key (free)
- Clone or download the World.CSS files to your web server
- Get an OpenWeatherMap API key from openweathermap.org
- Set up your backend API (see examples below)
- Include World.CSS in your HTML:
<link rel="stylesheet" href="assets/world.css"> <script src="assets/world-config.js"></script> <script src="assets/world.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My World.CSS Site</title>
<link rel="stylesheet" href="assets/world.css">
<script src="assets/world-config.js"></script>
<script src="assets/world.js"></script>
</head>
<body>
<h1>Welcome to my ambient website!</h1>
<p>This page automatically adapts to your environment.</p>
</body>
</html>
World.CSS works with any backend technology. Here are examples:
// backend/world.php - Already included
// Provides: locate, sun, weather endpoints
// server.js
const express = require('express');
const axios = require('axios');
app.get('/api/locate', async (req, res) => {
// IP geolocation logic
});
app.get('/api/sun', async (req, res) => {
// Solar calculation logic
});
app.get('/api/weather', async (req, res) => {
// Weather API logic
});
# app.py
from flask import Flask, jsonify
import requests
app = Flask(__name__)
@app.route('/api/locate')
def locate():
# IP geolocation logic
pass
@app.route('/api/sun')
def sun():
# Solar calculation logic
pass
@app.route('/api/weather')
def weather():
# Weather API logic
pass
# app.rb
require 'sinatra'
require 'net/http'
get '/api/locate' do
# IP geolocation logic
end
get '/api/sun' do
# Solar calculation logic
end
get '/api/weather' do
# Weather API logic
end
You can also use any existing API or create your own endpoints. World.CSS just needs:
- Geolocation (latitude/longitude)
- Solar data (elevation/azimuth)
- Weather data (temperature, conditions)
World-CSS/
βββ assets/
β βββ world.css # Main CSS with themes and variables
β βββ world.js # Core JavaScript engine
β βββ world-config.js # User configuration file
βββ backend/
β βββ world.php # PHP API endpoints (example)
β βββ config.php # API configuration
β βββ cache/ # Cached API responses
β βββ clean-cache.php # Cache cleanup script
βββ demo/
β βββ index.php # Interactive demo page
βββ example.html # Basic integration example
βββ .gitignore # Git ignore rules
βββ README.md # This file
Edit assets/world-config.js
to customize:
window.WorldCSSConfig = {
// API endpoints (change to match your backend)
api: {
locate: '/backend/world.php?action=locate',
sun: '/backend/world.php?action=sun',
weather: '/backend/world.php?action=weather'
},
// Color phases
phases: {
night: {
background: { hue: 240, saturation: 70, lightness: 15 },
accent: { hue: 200, saturation: 80, lightness: 60 },
text: '#ffffff'
},
// ... other phases
}
};
import React, { useEffect } from 'react';
import './assets/world.css';
function App() {
useEffect(() => {
// World.CSS automatically initializes
}, []);
return (
<div className="app">
<h1>My Ambient React App</h1>
</div>
);
}
<template>
<div class="app">
<h1>My Ambient Vue App</h1>
</div>
</template>
<script>
export default {
mounted() {
// World.CSS automatically initializes
}
}
</script>
<style>
@import './assets/world.css';
</style>
// app.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
template: '<div class="app"><h1>My Ambient Angular App</h1></div>',
styleUrls: ['./assets/world.css']
})
export class AppComponent implements OnInit {
ngOnInit() {
// World.CSS automatically initializes
}
}
- Real-time timeline showing current solar position
- Clickable phase indicators for testing different times
- Live color palette showing current theme colors
- Information cards with location, weather, and time data
- Mode toggle (Auto/Light/Dark)
- Beautiful glassmorphism UI with particle animations
- Simple integration example
- Timeline visualization of day progression
- Color swatches showing current theme
- Information display with solar and weather data
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Mobile browsers (iOS Safari, Chrome Mobile)
- No tracking - All data stays on your server
- IP geolocation - Uses your server's IP for location
- Secure API calls - All external requests go through your backend
- Cache system - Reduces API calls and improves performance
- Efficient caching - API responses cached for 1 hour
- Smooth transitions - CSS transitions for color changes
- Minimal JavaScript - Lightweight core engine
- Optimized updates - Only updates when necessary
-
Colors not changing
- Check browser console for errors
- Verify API endpoints are accessible
- Ensure OpenWeatherMap API key is valid
-
Location not detected
- Check server's IP geolocation
- Verify your backend API is accessible
- Check your backend's geolocation service
-
Weather not loading
- Verify OpenWeatherMap API key
- Check API rate limits
- Ensure your backend can make external requests
Enable debug logging in assets/world.js
:
const DEBUG = true; // Set to true for console logging
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Issues: GitHub Issues
- Documentation: Wiki
- Demo: Live Demo
World.CSS - Making the web feel alive, one sunrise at a time. π