terminal rgb colors in qolop
This commit is contained in:
@@ -92,9 +92,9 @@ if __name__ == "__main__":
|
|||||||
value = open(value[1:], 'rt').read()
|
value = open(value[1:], 'rt').read()
|
||||||
elif value[0:2] == "\\@":
|
elif value[0:2] == "\\@":
|
||||||
value = value[1:]
|
value = value[1:]
|
||||||
l = l.replace(p[0], value)
|
l = l.replace(p[0].encode('utf-8'), value.encode('utf-8'))
|
||||||
if options.env:
|
if options.env:
|
||||||
var_list = [m.group(0) for m in re.finditer('\${[^ ]+}', l)]
|
var_list = [m.group(0) for m in re.finditer('\${[^ ]+}', l)]
|
||||||
for v in var_list:
|
for v in var_list:
|
||||||
l = l.replace(v, os.environ.get(v[:-1][2:], ""))
|
l = l.replace(v, os.environ.get(v[:-1][2:], ""))
|
||||||
sys.stdout.write(l)
|
sys.stdout.write(l.decode('utf-8'))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
_qColVersion() { echo Version 2019.06.21.0; }
|
_qColVersion() { echo Version 2020.09.27.0; }
|
||||||
|
|
||||||
_qColHelp() {
|
_qColHelp() {
|
||||||
_qColVersion
|
_qColVersion
|
||||||
@@ -13,6 +13,7 @@ Functions:
|
|||||||
- _qCode: Print ANSI color codes by number sequence
|
- _qCode: Print ANSI color codes by number sequence
|
||||||
- _qParse: Print ANSI color by english words ex. "red", "lightgreen", "gray on blue"
|
- _qParse: Print ANSI color by english words ex. "red", "lightgreen", "gray on blue"
|
||||||
- _qPos: Move cursor
|
- _qPos: Move cursor
|
||||||
|
- _qRGB, _qRGBbg: Set color with 8bit integer triplet
|
||||||
- _qClr: Clear screen
|
- _qClr: Clear screen
|
||||||
- _qReset: Reset terminal
|
- _qReset: Reset terminal
|
||||||
|
|
||||||
@@ -39,8 +40,8 @@ Run qolop as script to print ANSI code table, or evaluate commands
|
|||||||
The first command produces string with ANSI commands, the
|
The first command produces string with ANSI commands, the
|
||||||
second will escape the escape characters, so you can copy/paste
|
second will escape the escape characters, so you can copy/paste
|
||||||
it in to another echo -e command.
|
it in to another echo -e command.
|
||||||
|
|
||||||
qolop c G
|
qolop c G
|
||||||
qolop p green
|
qolop p green
|
||||||
|
|
||||||
produce the same output, just the color code
|
produce the same output, just the color code
|
||||||
@@ -191,6 +192,15 @@ _qPos() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_qRGB() {
|
||||||
|
# Foreground 8-bit RGB triplet
|
||||||
|
printf '\033[38;2;%d;%d;%dm' "$1" "$2" "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qRGBbg() {
|
||||||
|
# Background 8-bit RGB triplet
|
||||||
|
printf '\033[48;2;%d;%d;%dm' "$1" "$2" "$3"
|
||||||
|
}
|
||||||
|
|
||||||
_qReset() {
|
_qReset() {
|
||||||
# Reset terminal
|
# Reset terminal
|
||||||
@@ -270,6 +280,7 @@ ${_S}====================${_Z}
|
|||||||
9 st ${_st}Strike ${_Z} 36 c ${_c}Cyan ${_Z}36;1 C ${_C}Cyan ${_Z}46 bc ${_k}${_bc}Cyan ${_Z}
|
9 st ${_st}Strike ${_Z} 36 c ${_c}Cyan ${_Z}36;1 C ${_C}Cyan ${_Z}46 bc ${_k}${_bc}Cyan ${_Z}
|
||||||
29 so ${_so}Strike off ${_Z} 37 w ${_w}White ${_Z}37;1 W ${_W}White ${_Z}47 bw ${_k}${_bw}White ${_Z}
|
29 so ${_so}Strike off ${_Z} 37 w ${_w}White ${_Z}37;1 W ${_W}White ${_Z}47 bw ${_k}${_bw}White ${_Z}
|
||||||
Enter raw color code sequence with _qCode function
|
Enter raw color code sequence with _qCode function
|
||||||
|
Use RGB triplets with _qRGB and _qRGBbg functions
|
||||||
${_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
|
||||||
|
|||||||
Reference in New Issue
Block a user