#!/usr/bin/env bash

echo
awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

# --- Environment diagnostics -------------------------------------------------
echo
echo "──────────────────────────────"
echo " Environment and Tmux Details "
echo "──────────────────────────────"
echo "TERM: ${TERM}"
echo "COLORTERM: ${COLORTERM:-undefined}"
echo

if command -v tmux >/dev/null && tmux info &>/dev/null; then
  echo "Tmux RGB/Tc capabilities:"
  tmux info | grep -E "RGB|Tc" || echo "(none found)"
  echo
  echo "Tmux server terminal options:"
  tmux show-options -s | grep terminal || echo "(none found)"
else
  echo "Tmux not running or unavailable."
fi

# --- Underline capability test -----------------------------------------------
echo
echo "Underline styles test:"
printf '\x1b[58:2::255:0:0m' # red underline color
printf '\x1b[4:1msingle '    # single underline
printf '\x1b[4:2mdouble '    # double underline
printf '\x1b[4:3mcurly '     # curly underline
printf '\x1b[4:4mdotted '    # dotted underline
printf '\x1b[4:5mdashed '    # dashed underline
printf '\x1b[0m\n'

echo
