#!/data/data/com.termux/files/usr/bin/bash
# cal: this month, today lit, weekends dimmed. Weeks start on Monday.
# termux.zanoski.com/widgets
e=$'\e'; R="${e}[0m"
first=$(date -d "$(date +%Y-%m-01)" +%u)
days=$(date -d "$(date +%Y-%m-01) +1 month -1 day" +%-d)
today=$(date +%-d)
echo "${e}[1;34m$(date '+%B %Y')$R"
echo "${e}[90mMo Tu We Th Fr Sa Su$R"
line=""; col=1
for ((i = 1; i < first; i++)); do line+="   "; col=$((col + 1)); done
for ((n = 1; n <= days; n++)); do
  cell=$(printf '%2d' $n)
  if [ $n -eq $today ]; then cell="${e}[1;33m$cell$R"
  elif [ $col -ge 6 ]; then cell="${e}[35m$cell$R"; fi
  line+="$cell "
  if [ $col -eq 7 ]; then echo "$line"; line=""; col=1; else col=$((col + 1)); fi
done
[ -n "$line" ] && echo "$line"
