Skip to content

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-workers-and-pages
Copy link

cloudflare-workers-and-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.

2 participants