Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple themes based on the sun #33

Merged
merged 12 commits into from
Jul 6, 2022
Merged

Multiple themes based on the sun #33

merged 12 commits into from
Jul 6, 2022

Conversation

JReinhold
Copy link
Owner

@JReinhold JReinhold commented Jul 6, 2022

This PR adds multiple themes to the root layout, that are automatically applied based on the sun's location in relation to the user.

The user's location is retrieved from the country code that Cloudflare Workers exposes as a header, which are converted to rough geocoordinates based on this table by Google.

Combining the geocoordinates and the current time allows us to calculate the sun's azimuth and altitutde to set a theme (eg. night, dusk, sunrise, noon, etc.).

The theme determines the background image and the accent colors for links, etc.

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jul 6, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ba5b3a
Status: ✅  Deploy successful!
Preview URL: https://b3080e07.reinhold.pages.dev
Branch Preview URL: https://sun-theme.reinhold.pages.dev

View logs

@JReinhold JReinhold marked this pull request as ready for review July 6, 2022 12:20
@JReinhold JReinhold merged commit 7f02e17 into main Jul 6, 2022
@JReinhold JReinhold deleted the sun-theme branch July 6, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant