feat: Amélioration de la librairie colors

This commit is contained in:
Xavier Logerais 2024-07-19 10:32:08 +00:00
parent f41e1c2411
commit af4807ed97

View File

@ -30,6 +30,12 @@
#48 Subscript #48 Subscript
#49 Superscript #49 Superscript
#bold_on=`escape 1m`
#bold_off=`escape 22m`
#blink_on=`escape 5m`
#blink_off=`escape 25m`
#reset=`escape 0m`
#T_ROWS=`tput lines` # Define current terminal dimension #T_ROWS=`tput lines` # Define current terminal dimension
#T_COLS=`tput cols` #+ in rows and columns. #T_COLS=`tput cols` #+ in rows and columns.
#_UNDERLINE_ON=`tput smul` # turn on underline #_UNDERLINE_ON=`tput smul` # turn on underline
@ -42,53 +48,33 @@
#tput rev - Display inverse colors #tput rev - Display inverse colors
#tput sgr0 - Reset everything #tput sgr0 - Reset everything
default='\E[39;49;00m' # Affiche un message stylisé sur la sortie standard
bold='\E[1m' function echo_bold { echo -e "\e[1m${*}\e[0m"; }
italic='\E[3m' function echo_faint { echo -e "\e[2m${*}\e[0m"; }
underline='\E[4m' function echo_italic { echo -e "\e[3m${*}\e[0m"; }
blink='\E[5m' function echo_underline { echo -e "\e[4m${*}\e[0m"; }
function echo_blink { echo -e "\e[5m${*}\e[0m"; }
function echo_reverse { echo -e "\e[7m${*}\e[0m"; }
function echo_concealed { echo -e "\e[8m${*}\e[0m"; }
blackonwhite='\E[30;47m' # Affiche un message informatif stylisé sur la sortie d'erreur
function echo_info { >&2 echo -e "\e[00;34;49m󰋼 ${*}\e[39;49;00m"; }
function echo_warning { >&2 echo -e "\e[00;33;49m ${*}\e[39;49;00m"; }
function echo_error { >&2 echo -e "\e[00;01;31;49m ${*}\e[39;49;00m"; }
function echo_success { >&2 echo -e "\e[00;01;32;49m ${*}\e[39;49;00m"; }
function echo_failed { >&2 echo -e "\e[00;01;31;49m✖ ${*}\e[39;49;00m"; }
#reset=`escape 0m` function echo_demo {
#black='\E[30;47m' echo_bold bold
#red='\E[31;47m' echo_faint faint
#green='\E[32;47m' echo_italic italic
#yellow='\E[33;47m' echo_underline underline
#blue='\E[34;47m' echo_blink blink
#magenta='\E[35;47m' echo_reverse reverse
#cyan='\E[36;47m' echo_concealed concealed
#white='\E[37;47m' echo_info info
#bold_on=`escape 1m` echo_warning warning
#bold_off=`escape 22m` echo_error error
#blink_on=`escape 5m` echo_success success
#blink_off=`escape 25m` echo_failed failed
function echo_reverse
{
echo -ne $blackonwhite
echo -ne "$*"
echo -e $default
}
function echo_italic
{
echo -ne $italic
echo -ne "$*"
echo -e $default
}
function echo_bold
{
echo -ne $bold
echo -ne "$*"
echo -e $default
}
function echo_underline
{
echo -ne $underline
echo -ne "$*"
echo -e $default
} }