[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Construct ANSI colour codes
From: |
pauline-galea |
Subject: |
Re: Construct ANSI colour codes |
Date: |
Wed, 7 Apr 2021 22:41:36 +0200 |
I need something clear because the reference suggests hard-coded colors
but for foreign systems you should rely on terminfo/termcap even if buggy.
I could actually do both. Have begun using the following code. Trying to
remove the first letter from "fgcl".
colr="Gn_dRd"
fgcl=`echo "$colr" | awk 'BEGIN {FS="_"} {print $2}'`
echo "fgcl: $fgcl"
case "$fgcl" in
"Bk")
s="30m"
;;
"Rd")
s="31m"
;;
"Gn")
s="32m"
;;
"Yl")
s="33m"
;;
"Bl")
s="34m"
;;
"Mg")
s="35m"
;;
"Cy")
s="36m"
;;
"Wh")
s="37m"
;;
*)
s=""
;;
esac
> Sent: Thursday, April 08, 2021 at 8:32 AM
> From: "Matias Fonzo" <selk@dragora.org>
> To: pauline-galea@gmx.com
> Cc: "help bash" <help-bash@gnu.org>
> Subject: Re: Construct ANSI colour codes
>
> El 2021-04-07 17:13, pauline-galea@gmx.com escribió:
> > I need ideas on how to construct ANSI colour codes, without hard-coding
> > them. Would really still need some scheme such that the actual
> > selection
> > is human readable. Perhaps a function that returns you the format
> > string.
> >
> > Example of scheme
> >
> > 'd' for dim, 'n' for normal
> > 'Gn' for Green, 'Rd' for Red, 'Bl' for blue
> >
> > 'dGn' for dim green foreground
> >
> > 'Bl_dGn' for blue background and dim green foreground
>
> See https://mywiki.wooledge.org/BashFAQ/037
>
>
Re: Construct ANSI colour codes, Greg Wooledge, 2021/04/07
Re: Construct ANSI colour codes, Alex fxmbsw7 Ratchev, 2021/04/07