compact ansi table

This commit is contained in:
ville rantanen
2017-08-20 10:24:05 +03:00
parent d70d240cf5
commit 438a755997

View File

@@ -1,16 +1,25 @@
#!/bin/bash #!/bin/bash
_qColVersion() { echo Version 2017.08.20.0; }
_qColHelp() { _qColHelp() {
_qColVersion
echo 'Quick shell COLOrizer Package echo 'Quick shell COLOrizer Package
Source me in BASH! Source me in BASH!
Version 2017.08.17.0 Functions:
- _qCol: Print ANSI color codes by letter codes.
Can export all letter codes as varibles.
- _qCode: Print ANSI color codes by number sequence
- _qPos: Move cursor
- _qClr: Clear screen
- _qReset: Reset terminal
Examples: Examples:
source qolop # load functions source qolop # load functions
- As functions: - As functions:
_title(){ _qCol z G; } _title(){ _qClr; _qCol z G; echo "$@"; _qCol z; }
_z(){ _qCol z; } _text(){ _qCol z; _qCode 1 34; echo "$@"; _qCol z; }
_title; echo Title; _z _title Title; _text Colored;
- As variables - As variables
TITLE=$( _qCol z G; ) TITLE=$( _qCol z G; )
@@ -122,6 +131,11 @@ _qClr() {
_qPos abs 0 0 _qPos abs 0 0
} }
_qReset() {
# Reset terminal
printf '\033c'
}
[[ "$0" = "${BASH_SOURCE[0]}" ]] && { [[ "$0" = "${BASH_SOURCE[0]}" ]] && {
_qColHelp _qColHelp
[[ "$1" = *"help" ]] && exit [[ "$1" = *"help" ]] && exit
@@ -130,24 +144,18 @@ _qClr() {
_qCol export "_" _qCol export "_"
printf "${_S}ANSI CODES AND QOLOP VARIABLES printf "${_S}ANSI CODES AND QOLOP VARIABLES
==============================${_Z} ==============================${_Z}
${_S}Fo${_U}rm${_st}at${_u}ti${_ic}ng${_Z} ESC[Xm ${_R}Co${_G}lo${_B}rs${_W} and ${_S}Mo${_U}di${_st}fi${_u}er${_ic}s${_Z} ESC[Xm or ESC[X;Y;Zm
${_S}==========${_Z} ${_S}====================${_Z}
0 Z Clear format 0 z Z Clear format
1 S ${_S}Strong ${_Z} 2 s ${_s}Off${_Z} 1 S ${_S}Strong/Bold ${_Z} 30 k ${_k}Black ${_Z}1 K ${_K}Black ${_Z}40 bk ${_bk}Black${_Z}
4 U ${_U}Underline${_Z} 24 u Off 2 s ${_s}Weak/Bold off ${_Z} 31 r ${_r}Red ${_Z}1 R ${_R}Red ${_Z}41 br ${_br}Red${_Z}
7 ic ${_ic}Inverse${_Z} 27 io Off 4 U ${_U}Underline ${_Z} 32 g ${_g}Green ${_Z}1 G ${_G}Green ${_Z}42 bg ${_bg}Green${_Z}
9 st ${_st}Strike${_Z} 29 so Off 24 u ${_u}Underline off ${_Z} 33 y ${_y}Yellow ${_Z}1 Y ${_Y}Yellow ${_Z}43 by ${_by}Yellow${_Z}
${_R}Co${_G}lo${_B}rs${_Z} ESC[Xm or ESC[X;Y;Zm 7 ic ${_ic}Inverse color ${_Z} 34 b ${_b}Blue ${_Z}1 B ${_B}Blue ${_Z}44 bb ${_bb}Blue${_Z}
${_S}======${_Z} 27 of ${_io}Inverse off ${_Z} 35 m ${_m}Magenta ${_Z}1 M ${_M}Magenta ${_Z}45 bm ${_bm}Magenta${_Z}
30 k ${_k}Black ${_Z}1 K ${_K}Strong ${_Z}40 bk ${_bk}Background${_Z} 9 st ${_st}Strike ${_Z} 36 c ${_c}Cyan ${_Z}1 C ${_C}Cyan ${_Z}46 bc ${_bc}Cyan${_Z}
31 r ${_r}Red ${_Z}1 R ${_R}Strong ${_Z}41 br ${_br}Background${_Z} 29 so ${_so}Strike off ${_Z} 37 w ${_w}White ${_Z}1 W ${_W}White ${_Z}47 bw ${_bw}White${_Z}
32 g ${_g}Green ${_Z}1 G ${_G}Strong ${_Z}42 bg ${_bg}Background${_Z} Enter raw color code sequence with _qCode function
33 y ${_y}Yellow ${_Z}1 Y ${_Y}Strong ${_Z}43 by ${_by}Background${_Z}
34 b ${_b}Blue ${_Z}1 B ${_B}Strong ${_Z}44 bb ${_bb}Background${_Z}
35 m ${_m}Magenta ${_Z}1 M ${_M}Strong ${_Z}45 bm ${_bm}Background${_Z}
36 c ${_c}Cyan ${_Z}1 C ${_C}Strong ${_Z}46 bc ${_bc}Background${_Z}
37 w ${_w}White ${_Z}1 W ${_W}Strong ${_Z}47 bw ${_bw}Background${_Z}
Enter raw color codes with _qCode function
${_S}Clearing and movement${_Z} ESC[X or ESC[1X ${_S}Clearing and movement${_Z} ESC[X or ESC[1X
${_S}=====================${_Z} ${_S}=====================${_Z}
2J CLR Clear screen 2J CLR Clear screen