TTY: on/off block pulse on the Linux console (shade fusion defeated)

YuKu tests on the bare Linux VT (not a terminal emulator): my 16-colour
fallback alternated blue (44) / bright blue (104), which render nearly
identically on VGA consoles -> fused into 'solid blue'. If TERM
misreports 256, 48;5;N codes are ignored outright.

Fixes:
- TERM linux*/console* forces the 16-colour path regardless of tput.
- 16-colour mode now PULSES THE BLOCK ON/OFF (2 frames blue block,
  2 frames no block, ~2.5Hz) instead of shade alternation — visible
  on any console hardware, no colour fidelity required.
- 256-colour terminals keep the deep 17->45 breathe ramp.

Verified: TERM=linux pty shows block/no-block alternation with zero
48;5 codes; TERM=xterm-256color keeps the 8-shade ramp; unattended +
piped regressions green.
This commit is contained in:
Pathfinder
2026-10-27 22:41:48 +01:00
parent 3d21a1c427
commit 71780291a3
2 changed files with 28 additions and 6 deletions
+8 -2
View File
@@ -31,6 +31,8 @@ _ub_depth() {
if [[ "$n" -ge 256 ]]; then echo 256
elif [[ "$n" -ge 8 ]]; then echo 16
else echo 0; fi
# bare Linux VT: cap regardless of what tput reports
case "${TERM:-}" in linux*|console*) echo 16 ;; esac
}
# paint one background-coloured block (a SPACE) + message
@@ -43,7 +45,7 @@ _ub_busy_loop() {
depth=$(_ub_depth)
case "$depth" in
256) pal=(17 19 21 27 33 39 45 39 33 27 21 19) ;; # deep breathe: dark navy to bright blue
16) pal=(44 104 44 104) ;; # blue / bright blue
16) pal=(44 44 "" "") ;; # on/off pulse: console blues fuse
*) pal=("|" "/" "-" "\\") ;; # last-resort spinner
esac
while :; do
@@ -51,7 +53,11 @@ _ub_busy_loop() {
if [[ "$depth" -eq 256 ]]; then
_ub_paint "48;5;$i" "$_UB_MSG" # 256-colour cube background
elif [[ "$depth" -eq 16 ]]; then
_ub_paint "$i" "$_UB_MSG" # plain ANSI background (44/104)
if [[ -n "$i" ]]; then
_ub_paint "$i" "$_UB_MSG" # plain ANSI background (blue)
else
printf '\r %s' "$_UB_MSG" >&"$_UB_FD" # block breathes out
fi
else
printf '\r[%s] %s' "$i" "$_UB_MSG" >&"$_UB_FD"
fi