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:
+20
-4
@@ -112,6 +112,10 @@ ui_quiet_run() {
|
||||
if (( nc >= 256 )); then depth=256
|
||||
elif (( nc >= 8 )); then depth=16
|
||||
fi
|
||||
# The bare Linux VT is 16-color VGA: 48;5;N codes are ignored there, and
|
||||
# its blue/bright-blue backgrounds render nearly identically (VM-proven:
|
||||
# "solid blue, no breathing" on the console). Cap to the 16-color path.
|
||||
case "${TERM:-}" in linux*|console*) depth=16 ;; esac
|
||||
|
||||
local -a bg=()
|
||||
case "$depth" in
|
||||
@@ -119,7 +123,9 @@ ui_quiet_run() {
|
||||
# shades must differ enough to survive flicker fusion — a subtle ramp
|
||||
# at 20fps reads as a solid block (VM-proven).
|
||||
256) bg=( "48;5;17" "48;5;19" "48;5;21" "48;5;27" "48;5;33" "48;5;39" "48;5;45" "48;5;39" "48;5;33" "48;5;27" "48;5;21" "48;5;19" ) ;;
|
||||
16) bg=( "44" "104" "44" "104" ) ;;
|
||||
# On/off pulse, NOT shade alternation: console blues fuse to solid.
|
||||
# Empty element = frame without the block (block breathes in/out).
|
||||
16) bg=( "44" "44" "" "" ) ;;
|
||||
esac
|
||||
local -a ch=( "|" "/" "-" "\\" )
|
||||
|
||||
@@ -131,10 +137,20 @@ ui_quiet_run() {
|
||||
| grep -E '^(Installing|Upgrading|Downgrading|Removing|Verifying|Preparing|Cleanup):' \
|
||||
| tail -n 1 || true)
|
||||
if (( depth >= 16 )); then
|
||||
if [[ -n "$cur" ]]; then
|
||||
printf '\r\033[%sm \033[0m %s: %s' "${bg[$(( f % ${#bg[@]} ))]}" "$msg" "$cur" >&2
|
||||
local code="${bg[$(( f % ${#bg[@]} ))]}"
|
||||
if [[ -n "$code" ]]; then
|
||||
if [[ -n "$cur" ]]; then
|
||||
printf '\r\033[%sm \033[0m %s: %s' "$code" "$msg" "$cur" >&2
|
||||
else
|
||||
printf '\r\033[%sm \033[0m %s' "$code" "$msg" >&2
|
||||
fi
|
||||
else
|
||||
printf '\r\033[%sm \033[0m %s' "${bg[$(( f % ${#bg[@]} ))]}" "$msg" >&2
|
||||
# block "breathes out": just the text that frame
|
||||
if [[ -n "$cur" ]]; then
|
||||
printf '\r %s: %s' "$msg" "$cur" >&2
|
||||
else
|
||||
printf '\r %s' "$msg" >&2
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [[ -n "$cur" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user