#!/bin/sh
#
# A little demo script that displays astronomical events
#
# Best used in a UTF-8 environment.
# SPDX-License-Identifier: GPL-2.0-only

# Set this variable to 1 if your terminal has a dark background or 0 if
# it: light.

bg_dark=1

# Set your latitude and longitude correctly for Sunrise/Sunset/Equinox/Solstice
#
# The values below are for Ottawa, Ontario, Canada
latitude="45.420556"
longitude="-75.689722"

remind -g -ibg_dark="$bg_dark" "-i\$Latitude=\"$latitude\"" "-i\$Longitude=\"$longitude\"" -q -@2 - "$@" <<'EOF'
SET $AddBlankLines 0
BANNER %

INCLUDE [$SysInclude]/ansitext.rem

MSG Today is [ansi_bold][$T][ansi_normal], being the [ord($T-date(year($T),1,1)+1)] day of [year($T)].%_

IF bg_dark
   SPECIAL COLOR 255 255 0 Sunrise:               🌅 [sunrise()] today and [sunrise($T+1)] tomorrow
   SPECIAL COLOR 255 128 0 Sunset:                🌇 [sunset()] today and [sunset($T+1)] tomorrow%_
ENDIF
EOF

remind -g -ibg_dark="$bg_dark" "-i\$Latitude=\"$latitude\"" "-i\$Longitude=\"$longitude\"" -q -@2 - "$@" <<'EOF'
SET $AddBlankLines 0
BANNER %
IF bg_dark
   REM [moondatetime(0)] +60 SPECIAL COLOR 255 255 0 New moon:              🌑 [$T] %3 (%b)
   REM [moondatetime(1)] +60 SPECIAL COLOR 255 255 128 First Quarter:         🌓 [$T] %3 (%b)
   REM [moondatetime(2)] +60 SPECIAL COLOR 255 255 255 Full moon:             🌕 [$T] %3 (%b)
   REM [moondatetime(3)] +60 SPECIAL COLOR 255 255 128 Last Quarter:          🌗 [$T] %3 (%b)
ELSE
   SPECIAL COLOR 128 128 0 Sunrise:               🌅 [sunrise()] today and [sunrise($T+1)] tomorrow
   SPECIAL COLOR 128 32 0 Sunset:                🌇 [sunset()] today and [sunset($T+1)] tomorrow%_

   REM [moondatetime(0)] +60 SPECIAL COLOR 128 128 0 New moon:              🌑 [$T] %3 (%b)
   REM [moondatetime(1)] +60 SPECIAL COLOR 128 128 64 First Quarter:         🌓 [$T] %3 (%b)
   REM [moondatetime(2)] +60 SPECIAL COLOR 0 0 0 Full moon:             🌕 [$T] %3 (%b)
   REM [moondatetime(3)] +60 SPECIAL COLOR 128 128 64 Last Quarter:          🌗 [$T] %3 (%b)
ENDIF
EOF

echo ""

remind -g -ibg_dark="$bg_dark" "-i\$Latitude=\"$latitude\"" "-i\$Longitude=\"$longitude\"" -q -@2 - "$@" <<'EOF'
SET $AddBlankLines 0
BANNER %

IF $LatDeg >= 0
   REM [soleq(0)] +366 MSG Next Vernal Equinox:   🌼 [$T] %3 (%b)
   REM [soleq(1)] +366 MSG Next Summer Solstice:  😎 [$T] %3 (%b)
   REM [soleq(2)] +366 MSG Next Autumnal Equinox: 🍂 [$T] %3 (%b)
   REM [soleq(3)] +366 MSG Next Winter Solstice:  ❄️  [$T] %3 (%b)
ELSE
   REM [soleq(0)] +366 MSG Next Autumnal Equinox: 🍂 [$T] %3 (%b)
   REM [soleq(1)] +366 MSG Next Winter Solstice:  ❄️  [$T] %3 (%b)
   REM [soleq(2)] +366 MSG Next Vernal Equinox:   🌼 [$T] %3 (%b)
   REM [soleq(3)] +366 MSG Next Summer Solstice:  😎 [$T] %3 (%b)
ENDIF

EOF
