help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

8-bit (256) terminal colours


From: michael-franzese
Subject: 8-bit (256) terminal colours
Date: Thu, 15 Apr 2021 04:13:43 +0200

Am getting confused about 8-bit (256) colours.

For 4-bit colours, I can understand the codes

\e[0;${bg};${fg}m  bg=(40..47), fg=(30..37)

But for 8-bit colours I have tried

\e[${fg};5;${bg}m  bg=(0..255), fg=(0..255)

Below is my attempt

     bi="38"
     for fi in {0..255} ; do
       # Display the color
       printf "\e[${fi};5;%sm  %3s  \e[0m" $bi $fi
       # Display 8 colors per lines
       if [ $((($fi + 1) % 8)) == 0 ] ; then
         echo # New line
       fi
     done







reply via email to

[Prev in Thread] Current Thread [Next in Thread]