From f4a65f9a8b7184e287a66ac496326f65f2fdca07 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 4 Jun 2022 10:12:46 -0400 Subject: [PATCH] Show colors in all possible modes in dump. --- bin/__build_sgr_code | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/__build_sgr_code b/bin/__build_sgr_code index 70360d5..6015727 100755 --- a/bin/__build_sgr_code +++ b/bin/__build_sgr_code @@ -70,7 +70,21 @@ function dump_colors() { for key in ${!map[@]} do - printf "%-24s${map[${key}]} |`$0 reset reverse fg:${key}`sample`$0 reset`|\n" ${key} + printf "%-24s${map[${key}]} |" ${key} + printf "`$0 reset reverse fg:${key}`native-sample`$0 reset`|" + if [[ ! -v CSHENV_TERMINAL_COLORS ]] || (( ${CSHENV_TERMINAL_COLORS} >= 256 )) + then + printf "`env CSHENV_TERMINAL_COLORS=256 $0 reset reverse fg:${key}`8-bit sample`$0 reset`|" + fi + if [[ ! -v CSHENV_TERMINAL_COLORS ]] || (( ${CSHENV_TERMINAL_COLORS} >= 16 )) + then + printf "`env CSHENV_TERMINAL_COLORS=16 $0 reset reverse fg:${key}`4-bit sample`$0 reset`|" + fi + if [[ ! -v CSHENV_TERMINAL_COLORS ]] || (( ${CSHENV_TERMINAL_COLORS} >= 8 )) + then + printf "`env CSHENV_TERMINAL_COLORS=8 $0 reset reverse fg:${key}`3-bit sample`$0 reset`|" + fi + printf "\n" done exit 0