https://github.com/velijv/flucss
CSS styles based on 🌇 sunset and 🌄 sunrise for visitor location. Like 🔆F.lux🔅, for the web. (night light / night shift)
https://github.com/velijv/flucss
ambient-light daylight night-light night-shift sun suncalc
Last synced: about 1 month ago
JSON representation
CSS styles based on 🌇 sunset and 🌄 sunrise for visitor location. Like 🔆F.lux🔅, for the web. (night light / night shift)
- Host: GitHub
- URL: https://github.com/velijv/flucss
- Owner: velijv
- Created: 2017-02-22T16:09:02.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-27T17:17:44.000Z (almost 3 years ago)
- Last Synced: 2025-01-19T20:22:47.116Z (over 1 year ago)
- Topics: ambient-light, daylight, night-light, night-shift, sun, suncalc
- Language: JavaScript
- Homepage: https://veli.ee/flucss
- Size: 329 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [FluCSS by Veli](http://veli.ee/flucss/)
jQuery plugin for CSS styles based on sunset and sunrise for visitor location. Like [F.lux](http://justgetflux.com/) / night light / night shift for the web.
> Note: this was originally created before the `prefers-color-scheme` CSS media feature was usable. But it is still relevant for gradual color temperature changing, instead of sharp boolean 🌑 **dark** or ☀️ **light**.
## 😎 [Preview demo](http://veli.ee/flucss/)
[](http://veli.ee/flucss/)
Easier on the eyes for night-time reading, useful for blogs and newspapers by eliminating blue light. Read more on [F.lux website](http://justgetflux.com/).
Options: Dimmed at night, Full black at night
🔆 How it works
## How it works:
1. Get your location (latitude, longitude) via HTML5 Geolocation API
2. Find sun states for location via SunCalc js
3. Calculate closest sun state for current time
4. Add CSS class on any element based on closest sun state
5. Use localStorage to prevent page flickering while navigating or reloading
🔅 How to use it
## How to use it:
1. Include jQuery
2. Include [SunCalc js](https://github.com/mourner/suncalc)
3. Include flucss.min.js and flucss.css
4. call $("html").flucss(); // for any element you want, mostly you want "html" or "body"
🌓 Color palette
## Color palette
Colors are modeled by dividing sun states into 4 groups — but you can add more variation if you need.
### Overlay color
Overlay color has eliminated blue channel - rgb(200,125,0) - keeping red and green, while maintaing contrast between background and text.
All color combinations pass the [WebAIM Color Contrast Checker](http://webaim.org/resources/contrastchecker/). Click on each color to validate.
### Normal mode
Start value: pure white, End value: pure gray (middle between black and white), with 2 equal distance steps in between. Overlaid by #c27c00.
### Full black night mode
Start value: pure white, End value: pure black, with 2 equal distance steps in between. Overlaid by #c27c00. Last 2 background colors get white text.