Color swatches mode for __build_sgr_code

This commit is contained in:
2026-07-30 01:21:34 -04:00
parent f5a336e4df
commit e2f7ec492f
+27 -5
View File
@@ -194,6 +194,21 @@ color_chart()
greyscale_chart greyscale_chart
} }
color_block()
{
printf "\e[37;1;48;5;${1}m%3i\e[m " ${1}
}
color_swatches()
{
while [ "$1" != "" ]
do
color_block $1
shift 1
done
printf "\n"
}
setup_color_depth() setup_color_depth()
{ {
use_8_bit=0 use_8_bit=0
@@ -544,11 +559,18 @@ build_sgr_code()
} }
output="" output=""
while [ ! -z $1 ]
do if [ "$1" = "color-swatches" ]
build_sgr_code $1 then
shift 1 shift 1
done color_swatches $*
else
while [ ! -z "$1" ]
do
build_sgr_code $1
shift 1
done
fi
if [ ! -z "${output}" ] && [ ${nocsi} -ne 1 ] if [ ! -z "${output}" ] && [ ${nocsi} -ne 1 ]
then then