Live data from Hacker News

Show HN: The current sky at your approximate location, as a CSS gradient

sky.dlazaro.ca

71–80 of 171 posts

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#71

Awesome. I remember much earlier in my career I was working on a 3D turn-by-turn navigation software, and one of my tasks was to draw the sky in the background. The more senior guy on the team said, just draw a blue rectangle during the day and a dark gray one at night and call it job done. Of course, I had to do it the hard way, so I looked up the relevant literature on sky rendering based on the environment, latitu…

Yep, if you have to draw the Sun, you better draw it yellow. If you have to draw a cloudless day sky, you better draw it blue.

That doesn't apply to every single instance of those, but if the sky isn't the focus of your application, a realistic one is just a distraction.

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#72

Awesome. I remember much earlier in my career I was working on a 3D turn-by-turn navigation software, and one of my tasks was to draw the sky in the background. The more senior guy on the team said, just draw a blue rectangle during the day and a dark gray one at night and call it job done. Of course, I had to do it the hard way, so I looked up the relevant literature on sky rendering based on the environment, latitu…

Ironically, I'm in the South of England wih clear blue sky, and the site thinks I have a much darker and beautiful reddish sunset. Im fairness, it's probably only out by an hour if that.

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#73
post #20

@dlazaro, I believe that style={{backgroundColor: bottom}} is not needed in: is not needed.

I actually included that so the tab and status bars are themed on iOS/Safari. Here's someone else's writeup on that: https://medium.com/@evkirkiles/coloring-the-webkit-browser-b...

Wow, this works in chrome on Android as well

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#74
As an old-timer who's not up on all the latest whiz-bang web stuff, I have to ask what is the astro/cloudflare/wrangler magic that allows the following to work:

  const { latitude = "0", longitude = "0" } = Astro.locals.runtime.cf || {};
I gather you're using some cloudflare feature wrapped in astro to provide lat/long but I don't see the actual plumbing that gets it to you (and I did try to spelunk through a decent amount of documentation to find it). Can you elaborate?

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#75

Earlier quoted context omitted.

Whipping down the innovator with the stupidity whip. Great management

A foundational, core theme about making commercial software, that repeats over and over and I slowly got accustomed to is: companies really don't want these kinds of micro-innovations. 90% of companies are just looking at their competitors, making a checklist out of those products, and asking engineers to check the boxes and go home. They don't care about little details, about craftsmanship and polish, about lint war…

But it's exactly the thing that makes software "delightful". It's also a huge boost to the developer's appreciation, motivation, productivity, care for the product.

But yeah, if you only care about checking the feature boxes.. Go ahead, make shit software with miserable people, but be sure to prepare to go out of business.

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#76

As an old-timer who's not up on all the latest whiz-bang web stuff, I have to ask what is the astro/cloudflare/wrangler magic that allows the following to work: const { latitude = "0", longitude = "0" } = Astro.locals.runtime.cf || {}; I gather you're using some cloudflare feature wrapped in astro to provide lat/long but I don't see the actual plumbing that gets it to you (and I did try to spelunk through a decent am…

You can enable a feature in Cloudflare which will inject the approximate user's lat/lng (based on their IP (and other factors?)) as an HTTP header added to the original request:

https://developers.cloudflare.com/network/ip-geolocation/

"This Managed Transform adds HTTP request headers with location information for the visitor's IP address, such as city, country, continent, longitude, and latitude."

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#77

Awesome. I remember much earlier in my career I was working on a 3D turn-by-turn navigation software, and one of my tasks was to draw the sky in the background. The more senior guy on the team said, just draw a blue rectangle during the day and a dark gray one at night and call it job done. Of course, I had to do it the hard way, so I looked up the relevant literature on sky rendering based on the environment, latitu…

A past coworker who worked on Cobalt[1] told me that they spent entirely too much time implementing stars in the sky of the game with some amount of real(ish) star system physics behind them. I can understand people removing polish things like that if there are usability concerns, but those small things add up to a lot in an end product and are a joy to find and explore. 1: https://en.wikipedia.org/wiki/Cobalt_(video…

Cobalt was a really interesting game, too bad it never got any fame

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#78
post #56
post #52

Author of Suncalc here — this is exactly the kind of stuff I love to see my code being used in, thanks for sharing!

Author or contributor? Great work, by the way, I love such shows

Wrote it 14 years ago! https://github.com/mourner/suncalc/ It's a bit neglected but I'll do some upkeep shortly...

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#79
post #52

Author of Suncalc here — this is exactly the kind of stuff I love to see my code being used in, thanks for sharing!

Hey, small note that your excellent https://suncalc.net/ is showing an error due to the Google Maps API token having expired.

I know that you deeply know map tech :-) but if I may make a suggestion - you might consider switching from Google Maps to Protomaps? https://github.com/protomaps/protomaps-leaflet

Cheers

Re: Show HN: The current sky at your approximate location, as a CSS gradient

#80

As an old-timer who's not up on all the latest whiz-bang web stuff, I have to ask what is the astro/cloudflare/wrangler magic that allows the following to work: const { latitude = "0", longitude = "0" } = Astro.locals.runtime.cf || {}; I gather you're using some cloudflare feature wrapped in astro to provide lat/long but I don't see the actual plumbing that gets it to you (and I did try to spelunk through a decent am…

There is no visible plumbing because it kinda is magic! Astro provides adapters for different server runtimes (e.g., Vercel, Cloudflare, Netlify), and it's basically just plug and play. The Cloudflare adapter exposes a bunch of bindings [1] through `Astro.locals.runtime`, which can be accessed during each request. The `cf` binding contains incoming request properties [2], including latitude and longitude.

These bindings (or at least some of them) are also mocked when developing locally, in a non-Cloudflare-Workers environment.

[1] https://developers.cloudflare.com/workers/wrangler/api/#supp...

[2] https://developers.cloudflare.com/workers/runtime-apis/reque...

Post reply on HN