[HN Gopher] Show HN: Daylight - track sunrise / sunset times in ...
       ___________________________________________________________________
        
       Show HN: Daylight - track sunrise / sunset times in your terminal
        
       I love the sunlight and dread the long, dark winter evenings of
       Northern Europe. I often look up sunrise / sunset times and count
       off the days until the darkness is gone.  Now I've written a
       terminal app for this (Mac/Linux)  Features: a colorful summary of
       daylight times for your location; projected change over the coming
       days; handles NO_COLOR and a ---short flag if you dislike the
       output format.  The location is IP-based but you can override this
       if you're on a VPN. Just create a terminal alias with the --loc
       flag. The app supports areas in the arctic / antarctic circle too.
       Check our the repository for a preview and instructions on how you
       can install it with Homebrew.  (There is a Windows build but it's
       not yet tested)
        
       Author : jbreckmckye
       Score  : 53 points
       Date   : 2025-03-09 12:21 UTC (3 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | japaget wrote:
       | Windows build works fine (Windows 10 Professional x64 22H2).
        
         | jbreckmckye wrote:
         | Thanks! (Don't have a Windows machine right now so that's very
         | helpful)
        
       | rrr_oh_man wrote:
       | Great looking app!!
       | 
       | I immediately checked how you do location lookups:
       | 
       |  _> IP lookup is powered by https://ipinfo.io. They provide a
       | good service so please don't spam requests._
       | 
       | There was a thread about them recently -- the scale of their
       | operation was very surprising.
        
         | jbreckmckye wrote:
         | It _is_ possible to use native OS APIs for location lookup, but
         | these all seem to rely on cgo. Which was a bit intimidating for
         | a "let's learn Golang" project
         | 
         | (Probably not the nicest code and no doubt I've broken a lot of
         | Go idioms, but it was a good learning exercise)
         | 
         | IPInfo is a good service and their developer relations were
         | surprisingly relaxed about me (mis)using their API this way
        
       | thenthenthen wrote:
       | Cool! Can we use the sky hue as Terminal background or overal
       | "theme"?
        
       | oftenwrong wrote:
       | I was curious how the times were obtained. It uses
       | https://github.com/nathan-osman/go-sunrise , which links to this
       | calculation method:
       | https://en.wikipedia.org/wiki/Sunrise_equation#Complete_calc...
        
       | ndegruchy wrote:
       | Of course, you can get this information in Emacs, too. You'll
       | need to get your lat and long, first:                   (setq
       | calendar-latitude  12.3456               calendar-longitude
       | -98.7654)
       | 
       | Then, you can `M-x sunrise-sunset` and see the times (and total
       | daylight hours) in the echo area.
        
       | jrootabega wrote:
       | Is the noon color scheme supposed to look like Finn from
       | Adventure Time?
        
       | voidUpdate wrote:
       | Does this pull the times from an online service or are they
       | calculated locally? I tried to read the code to work it out but I
       | don't program in Go so I got a little lost
        
         | jbreckmckye wrote:
         | It gets your latitude/longitude from an IP lookup service, then
         | does a geometric calculation locally
        
           | jmholla wrote:
           | Is there a configuration file or command line option to
           | provide location information manually?
        
             | jbreckmckye wrote:
             | Yes, you can use `--loc="12.34,56.78"` where the values are
             | longitude and latitude.
             | 
             | You can also override the Timezone with `--timezone`
             | (passing an IANA timezone e.g. America/New_York).
        
       | kseistrup wrote:
       | This is nice, I like it!
       | 
       | Is there a way to make it use 24h time, rather than AM/PM?
        
         | kseistrup wrote:
         | If I use e.g. `daylight --timezone=Europe/Copenhagen` it does
         | actually show the 24h times, which is nice. But til still
         | appends AM/PM, which is kind of weird. :)
        
       ___________________________________________________________________
       (page generated 2025-03-12 23:01 UTC)