from Hacker News

Show HN: Daylight – track sunrise / sunset times in your terminal

by jbreckmckye on 3/9/25, 12:21 PM with 19 comments

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)

  • by oftenwrong on 3/12/25, 10:23 AM

    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...
  • by ndegruchy on 3/12/25, 12:45 PM

    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.
  • by rrr_oh_man on 3/12/25, 7:07 AM

    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.

  • by japaget on 3/12/25, 5:00 AM

    Windows build works fine (Windows 10 Professional x64 22H2).
  • by JimmyDeep on 3/18/25, 1:03 AM

    I live in a place where it often rains, and I really love sunny weather. It makes me feel a bit down when I see that it's already dark by the time I get off work. I was wondering, since the Earth's revolution is taken into account, the time you get should be different every day, right?
  • by voidUpdate on 3/12/25, 3:27 PM

    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
  • by thenthenthen on 3/12/25, 9:50 AM

    Cool! Can we use the sky hue as Terminal background or overal “theme”?
  • by jrootabega on 3/12/25, 2:01 PM

    Is the noon color scheme supposed to look like Finn from Adventure Time?
  • by kseistrup on 3/12/25, 8:02 PM

    This is nice, I like it!

    Is there a way to make it use 24h time, rather than AM/PM?