From 438a7559972a158e82723f5747b06e023b367215 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Sun, 20 Aug 2017 10:24:05 +0300 Subject: [PATCH] compact ansi table --- reporting/qolop | 52 ++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/reporting/qolop b/reporting/qolop index fa3e106..d8d11ff 100755 --- a/reporting/qolop +++ b/reporting/qolop @@ -1,16 +1,25 @@ #!/bin/bash +_qColVersion() { echo Version 2017.08.20.0; } _qColHelp() { + _qColVersion echo 'Quick shell COLOrizer Package 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: source qolop # load functions - As functions: - _title(){ _qCol z G; } - _z(){ _qCol z; } - _title; echo Title; _z + _title(){ _qClr; _qCol z G; echo "$@"; _qCol z; } + _text(){ _qCol z; _qCode 1 34; echo "$@"; _qCol z; } + _title Title; _text Colored; - As variables TITLE=$( _qCol z G; ) @@ -122,6 +131,11 @@ _qClr() { _qPos abs 0 0 } +_qReset() { + # Reset terminal + printf '\033c' +} + [[ "$0" = "${BASH_SOURCE[0]}" ]] && { _qColHelp [[ "$1" = *"help" ]] && exit @@ -130,24 +144,18 @@ _qClr() { _qCol export "_" printf "${_S}ANSI CODES AND QOLOP VARIABLES ==============================${_Z} -${_S}Fo${_U}rm${_st}at${_u}ti${_ic}ng${_Z} ESC[Xm -${_S}==========${_Z} - 0 Z Clear format - 1 S ${_S}Strong ${_Z} 2 s ${_s}Off${_Z} - 4 U ${_U}Underline${_Z} 24 u Off - 7 ic ${_ic}Inverse${_Z} 27 io Off - 9 st ${_st}Strike${_Z} 29 so Off -${_R}Co${_G}lo${_B}rs${_Z} ESC[Xm or ESC[X;Y;Zm -${_S}======${_Z} - 30 k ${_k}Black ${_Z}1 K ${_K}Strong ${_Z}40 bk ${_bk}Background${_Z} - 31 r ${_r}Red ${_Z}1 R ${_R}Strong ${_Z}41 br ${_br}Background${_Z} - 32 g ${_g}Green ${_Z}1 G ${_G}Strong ${_Z}42 bg ${_bg}Background${_Z} - 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 +${_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} + 0 z Z Clear format + 1 S ${_S}Strong/Bold ${_Z} 30 k ${_k}Black ${_Z}1 K ${_K}Black ${_Z}40 bk ${_bk}Black${_Z} + 2 s ${_s}Weak/Bold off ${_Z} 31 r ${_r}Red ${_Z}1 R ${_R}Red ${_Z}41 br ${_br}Red${_Z} + 4 U ${_U}Underline ${_Z} 32 g ${_g}Green ${_Z}1 G ${_G}Green ${_Z}42 bg ${_bg}Green${_Z} + 24 u ${_u}Underline off ${_Z} 33 y ${_y}Yellow ${_Z}1 Y ${_Y}Yellow ${_Z}43 by ${_by}Yellow${_Z} + 7 ic ${_ic}Inverse color ${_Z} 34 b ${_b}Blue ${_Z}1 B ${_B}Blue ${_Z}44 bb ${_bb}Blue${_Z} + 27 of ${_io}Inverse off ${_Z} 35 m ${_m}Magenta ${_Z}1 M ${_M}Magenta ${_Z}45 bm ${_bm}Magenta${_Z} + 9 st ${_st}Strike ${_Z} 36 c ${_c}Cyan ${_Z}1 C ${_C}Cyan ${_Z}46 bc ${_bc}Cyan${_Z} + 29 so ${_so}Strike off ${_Z} 37 w ${_w}White ${_Z}1 W ${_W}White ${_Z}47 bw ${_bw}White${_Z} + Enter raw color code sequence with _qCode function ${_S}Clearing and movement${_Z} ESC[X or ESC[1X ${_S}=====================${_Z} 2J CLR Clear screen