mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
updated coloring with latest changes
This commit is contained in:
parent
1b6a2da5a1
commit
6c94250231
12 changed files with 204 additions and 230 deletions
|
@ -1,15 +1,16 @@
|
|||
let term_cols = ((term size -w) - 1)
|
||||
|
||||
# let's itertate through each of the columns of our terminal
|
||||
echo 0..$term_cols |
|
||||
each {
|
||||
let r = (255 - ($it * 255 / $term_cols) | math round)
|
||||
let g = ($it * 510 / $term_cols | math round)
|
||||
let b = ($it * 255 / $term_cols | math round)
|
||||
each { |col|
|
||||
let r = (255 - ($col * 255 / $term_cols) | math round)
|
||||
let g = ($col * 510 / $term_cols | math round)
|
||||
let b = ($col * 255 / $term_cols | math round)
|
||||
if $g > 255 {
|
||||
let g = (510 - $g)
|
||||
echo (build-colorstr $r $g $b) | autoview
|
||||
build-colorstr $r $g $b $col | autoview
|
||||
} {
|
||||
echo (build-colorstr $r $g $b) | autoview
|
||||
build-colorstr $r $g $b $col | autoview
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,23 +18,23 @@ def build-colorstr [
|
|||
r:int # Red
|
||||
g:int # Green
|
||||
b:int # Blue
|
||||
c:int # Column
|
||||
] {
|
||||
# log (build-string "R=" $r " G=" $g " B=" $b)
|
||||
let bg = (build-string (ansi rgb_bg) $r ';' $g ';' $b 'm')
|
||||
let fg = (build-string (ansi rgb_fg) (255 - $r) ';' (255 - $g) ';' (255 - $b) 'm')
|
||||
let idx = ($it mod 2)
|
||||
# Heavy use of string interpolation below
|
||||
let bg = $"(ansi rgb_bg)($r);($g);($b)m"
|
||||
let fg = $"(ansi rgb_fg)(255 - $r);(255 - $g);(255 - $b)m"
|
||||
let idx = ($c mod 2)
|
||||
let slash_str = (if $idx == 0 {
|
||||
build-string "/" (ansi reset)
|
||||
$"/(ansi reset)"
|
||||
} {
|
||||
build-string "\" (ansi reset)
|
||||
$"\(ansi reset)"
|
||||
})
|
||||
build-string $bg $fg $slash_str
|
||||
# log (build-string $bg $fg $slash_str | debug)
|
||||
$"($bg)($fg)($slash_str)"
|
||||
}
|
||||
|
||||
# This is a first attempt and some type of logging
|
||||
def log [message:any] {
|
||||
let now = (date now | date format '%Y%m%d_%H%M%S.%f')
|
||||
let mess = (build-string $now '|DBG|' $message (char newline))
|
||||
let mess = $"($now)|DBG|($message)(char nl)"
|
||||
echo $mess | autoview
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
def make_header [hi] {
|
||||
if $hi == $true {
|
||||
let ansi100m = (echo '100m' | str lpad -l 11 -c ' ')
|
||||
let ansi101m = (echo '101m' | str lpad -l 9 -c ' ')
|
||||
let ansi102m = (echo '102m' | str lpad -l 9 -c ' ')
|
||||
let ansi103m = (echo '103m' | str lpad -l 9 -c ' ')
|
||||
let ansi104m = (echo '104m' | str lpad -l 9 -c ' ')
|
||||
let ansi105m = (echo '105m' | str lpad -l 9 -c ' ')
|
||||
let ansi106m = (echo '106m' | str lpad -l 9 -c ' ')
|
||||
let ansi107m = (echo '107m' | str lpad -l 9 -c ' ')
|
||||
echo [(char newline) $ansi100m $ansi101m $ansi102m $ansi103m $ansi104m $ansi105m $ansi106m $ansi107m (char newline)] | str collect
|
||||
let ansi100m = ('100m' | str lpad -l 11 -c ' ')
|
||||
let ansi101m = ('101m' | str lpad -l 9 -c ' ')
|
||||
let ansi102m = ('102m' | str lpad -l 9 -c ' ')
|
||||
let ansi103m = ('103m' | str lpad -l 9 -c ' ')
|
||||
let ansi104m = ('104m' | str lpad -l 9 -c ' ')
|
||||
let ansi105m = ('105m' | str lpad -l 9 -c ' ')
|
||||
let ansi106m = ('106m' | str lpad -l 9 -c ' ')
|
||||
let ansi107m = ('107m' | str lpad -l 9 -c ' ')
|
||||
$"(char newline)($ansi100m)($ansi101m)($ansi102m)($ansi103m)($ansi104m)($ansi105m)($ansi106m)($ansi107m)(char newline)"
|
||||
} {
|
||||
let ansi40m = (echo '40m' | str lpad -l 10 -c ' ')
|
||||
let ansi41m = (echo '41m' | str lpad -l 8 -c ' ')
|
||||
let ansi42m = (echo '42m' | str lpad -l 8 -c ' ')
|
||||
let ansi43m = (echo '43m' | str lpad -l 8 -c ' ')
|
||||
let ansi44m = (echo '44m' | str lpad -l 8 -c ' ')
|
||||
let ansi45m = (echo '45m' | str lpad -l 8 -c ' ')
|
||||
let ansi46m = (echo '46m' | str lpad -l 8 -c ' ')
|
||||
let ansi47m = (echo '47m' | str lpad -l 8 -c ' ')
|
||||
echo [(char newline) $ansi40m $ansi41m $ansi42m $ansi43m $ansi44m $ansi45m $ansi46m $ansi47m (char newline)] | str collect
|
||||
let ansi40m = ('40m' | str lpad -l 10 -c ' ')
|
||||
let ansi41m = ('41m' | str lpad -l 8 -c ' ')
|
||||
let ansi42m = ('42m' | str lpad -l 8 -c ' ')
|
||||
let ansi43m = ('43m' | str lpad -l 8 -c ' ')
|
||||
let ansi44m = ('44m' | str lpad -l 8 -c ' ')
|
||||
let ansi45m = ('45m' | str lpad -l 8 -c ' ')
|
||||
let ansi46m = ('46m' | str lpad -l 8 -c ' ')
|
||||
let ansi47m = ('47m' | str lpad -l 8 -c ' ')
|
||||
$"(char newline)($ansi40m)($ansi41m)($ansi42m)($ansi43m)($ansi44m)($ansi45m)($ansi46m)($ansi47m)(char newline)"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,23 +32,19 @@ def mk_header [color_range:range] {
|
|||
let hi_regular_pad = 9
|
||||
let lo_start_pad = 10
|
||||
let lo_regular_pad = 8
|
||||
echo $color_range | each {
|
||||
let ansi_color = (echo [(build-string $it 'm')])
|
||||
if $it == $min_rng {
|
||||
echo $color_range | each { |color|
|
||||
let ansi_color = $"($color)m"
|
||||
if $color == $min_rng {
|
||||
if $min_rng == 100 {
|
||||
let header = (echo $ansi_color | str lpad -l $hi_start_pad -c ' ')
|
||||
echo $header
|
||||
($ansi_color | str lpad -l $hi_start_pad -c ' ')
|
||||
} {
|
||||
let header = (echo $ansi_color | str lpad -l $lo_start_pad -c ' ')
|
||||
echo $header
|
||||
($ansi_color | str lpad -l $lo_start_pad -c ' ')
|
||||
}
|
||||
} {
|
||||
if $min_rng >= 100 {
|
||||
let header = (echo $ansi_color | str lpad -l $hi_regular_pad -c ' ')
|
||||
echo $header
|
||||
($ansi_color | str lpad -l $hi_regular_pad -c ' ')
|
||||
} {
|
||||
let header = (echo $ansi_color | str lpad -l $lo_regular_pad -c ' ')
|
||||
echo $header
|
||||
($ansi_color | str lpad -l $lo_regular_pad -c ' ')
|
||||
}
|
||||
}
|
||||
} | str collect
|
||||
|
@ -57,28 +53,28 @@ def mk_header [color_range:range] {
|
|||
|
||||
def color_row_range [num:int bg_rg:range] {
|
||||
let reset = (ansi reset)
|
||||
let row_header = (build-string $num "m " (ansi reset))
|
||||
let row_data = (echo $bg_rg | each {
|
||||
let row_name = (echo [(build-string $num ';' $it) "m"] | str collect)
|
||||
let row_header = $"($num)m ($reset)"
|
||||
let row_data = (echo $bg_rg | each { |back|
|
||||
let row_name = $"($num);($back)m"
|
||||
let ansi_color = (ansi -e $row_name)
|
||||
echo [$ansi_color ' ' $row_name ' ' $reset] | str collect
|
||||
$"($ansi_color) ($row_name) ($reset)"
|
||||
} | append (char newline) | str collect)
|
||||
echo [$row_header $row_data] | str collect
|
||||
$"($row_header)($row_data)"
|
||||
}
|
||||
|
||||
def create_color_tables [fg_range:range bg_range:range] {
|
||||
echo $fg_range | each {
|
||||
color_row_range $it $bg_range
|
||||
echo $fg_range | each { |fg|
|
||||
color_row_range $fg $bg_range
|
||||
} | str collect
|
||||
}
|
||||
|
||||
def color_table [] {
|
||||
#make_header $false
|
||||
# make_header $false
|
||||
mk_header 40..47
|
||||
create_color_tables 30..37 40..47
|
||||
|
||||
# put a line between tables
|
||||
echo (char newline)
|
||||
char newline
|
||||
|
||||
#make_header $true
|
||||
mk_header 100..107
|
||||
|
|
|
@ -10,16 +10,13 @@
|
|||
# done
|
||||
# echo ""
|
||||
|
||||
echo 0..8 | each {
|
||||
let x = $it
|
||||
let row = (echo 30..37 | each {
|
||||
let i = $it
|
||||
let row = (echo 40..47 | each {
|
||||
let a = $it
|
||||
let color = (build-string $x ';' $i ';' $a 'm')
|
||||
echo [(ansi -e $color) $color (ansi reset) ' ']
|
||||
echo 0..8 | each { |style|
|
||||
let row = (echo 30..37 | each { |fg|
|
||||
let row = (echo 40..47 | each { |bg|
|
||||
let color = $"($style);($fg);($bg)m"
|
||||
$"(ansi -e $color)($color)(ansi reset) "
|
||||
} | str collect)
|
||||
echo [$row (char newline)] | str collect
|
||||
$"($row)(char newline)"
|
||||
} | str collect)
|
||||
echo [$row (char newline)] | str collect
|
||||
$"($row)(char newline)"
|
||||
} | str collect
|
|
@ -1,22 +1,24 @@
|
|||
# this script will print a blue gradient on the screen
|
||||
|
||||
# We can get the terminal width and height now with term size
|
||||
# but we like to use the script as a benchmark, so let's keep
|
||||
# it a constant size for now
|
||||
let height = 40 # really need to get the terminal height here
|
||||
let width = 160 # really need to get the terminal width here
|
||||
|
||||
let stamp = 'Nu'
|
||||
seq 0 $height | each {
|
||||
let row_data = (seq 0 $width | each {
|
||||
let fgcolor = (iter_inc 2 2 $it)
|
||||
let row_data = (seq 0 $width | each { |col|
|
||||
let fgcolor = (iter_inc 2 2 $col)
|
||||
if $fgcolor > 200 && $fgcolor < 210 {
|
||||
echo [(ansi -e '48;2;0;0;') (build-string $fgcolor m) 'Nu' (ansi -e '0m')] | str collect
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m($stamp)(ansi -e '0m')"
|
||||
} {
|
||||
echo [(ansi -e '48;2;0;0;') (build-string $fgcolor m) ' ' (ansi -e '0m')] | str collect
|
||||
$"(ansi -e '48;2;0;0;')($fgcolor)m(char sp)(ansi -e '0m')"
|
||||
}
|
||||
} | str collect)
|
||||
echo [$row_data (char newline)] | str collect | autoview
|
||||
$"($row_data)(char newline)" | autoview
|
||||
} | str collect
|
||||
|
||||
def iter_inc [incr mult iter] {
|
||||
# echo (build-string $incr + $mult * $iter) | math eval | math round
|
||||
$incr + $mult * $iter
|
||||
}
|
||||
|
||||
|
@ -25,15 +27,15 @@ def iter_inc [incr mult iter] {
|
|||
# ├────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
# │ 0 │ version │ 0.31.1 │
|
||||
# │ 1 │ branch │ main │
|
||||
# │ 2 │ short_commit │ 3aa00b78 │
|
||||
# │ 3 │ commit_hash │ 3aa00b78f95b308a6d76eef086e018cd0e0252d0 │
|
||||
# │ 4 │ commit_date │ 2021-05-12 03:53:34 │
|
||||
# │ 2 │ short_commit │ 751de20f │
|
||||
# │ 3 │ commit_hash │ 751de20f938ed200ae6128a30d06a5dd24a4fd33 │
|
||||
# │ 4 │ commit_date │ 2021-05-21 02:04:27 │
|
||||
# │ 5 │ build_os │ windows-x86_64 │
|
||||
# │ 6 │ rust_version │ rustc 1.52.1 (9bc8c42bb 2021-05-09) │
|
||||
# │ 7 │ rust_channel │ stable (default) │
|
||||
# │ 8 │ cargo_version │ cargo 1.52.0 (69767412a 2021-04-21) │
|
||||
# │ 9 │ pkg_version │ 0.31.1 │
|
||||
# │ 10 │ build_time │ 2021-05-12 07:37:45 │
|
||||
# │ 10 │ build_time │ 2021-05-21 07:20:25 │
|
||||
# │ 11 │ build_rust_channel │ release │
|
||||
# │ 12 │ features │ clipboard-cli, ctrlc, default, directories, dirs, ptree, rustyline, term, trash, uuid, which, zip │
|
||||
# ╰────┴────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────╯
|
|
@ -1,19 +1,15 @@
|
|||
def show_index_colors [] {
|
||||
let prefix = "48;5;"
|
||||
let relet_color = "0m"
|
||||
echo 1..256 | each {
|
||||
let cr = (echo (build-string $it % 16) | math eval)
|
||||
let color = (echo [(ansi -e $prefix) (build-string $it) 'm'] | str collect)
|
||||
let padded_number = (echo (build-string $it | str lpad -l 3 -c '0'))
|
||||
echo 1..256 | each { |idx|
|
||||
let cr = ($"($idx) % 16" | math eval)
|
||||
let color = $"(ansi -e $prefix)($idx)m"
|
||||
let padded_number = ($"($idx)" | str lpad -l 3 -c '0')
|
||||
if $cr == 0 {
|
||||
echo [$color $padded_number ' ' (ansi -e $relet_color) (char newline)]
|
||||
$"($color)($padded_number) (ansi -e 0m)(char newline)"
|
||||
} {
|
||||
echo [$color $padded_number ' ' (ansi -e $relet_color)]
|
||||
$"($color)($padded_number) (ansi -e 0m)"
|
||||
}
|
||||
} | str collect
|
||||
}
|
||||
|
||||
show_index_colors
|
||||
|
||||
#one-liner
|
||||
#echo 0..255 | each {echo [(ansi -e '38;5;') (build-string $it) 'm' (build-string $it) ' ']} | str collect
|
|
@ -1,11 +1,11 @@
|
|||
def show_index_colors [] {
|
||||
let prefix = "38;5;"
|
||||
echo 1..256 | each {
|
||||
let cr = (echo (build-string $it % 16) | math eval)
|
||||
echo 1..256 | each { |fg|
|
||||
let cr = ($"($fg) % 16" | math eval)
|
||||
if $cr == 0 {
|
||||
echo [(ansi -e $prefix) (build-string $it) 'm' (build-string $it | str lpad -l 3 -c '0') ' ' (char newline)]
|
||||
$"(ansi -e $prefix)($fg)m($fg | into string | str lpad -l 3 -c '0') (char newline)"
|
||||
} {
|
||||
echo [(ansi -e $prefix) (build-string $it) 'm' (build-string $it | str lpad -l 3 -c '0') ' ']
|
||||
$"(ansi -e $prefix)($fg)m($fg | into string | str lpad -l 3 -c '0') "
|
||||
}
|
||||
} | str collect
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ def show_index_colors [] {
|
|||
show_index_colors
|
||||
|
||||
#one-liner
|
||||
#echo 0..255 | each {echo [(ansi -e '38;5;') (build-string $it) 'm' (build-string $it) ' ']} | str collect
|
||||
#echo 0..255 | each { |fg| echo [(ansi -e '38;5;') ($fg | into string) 'm' ($fg | into string) ' ']} | str collect
|
|
@ -3,14 +3,15 @@
|
|||
# different color
|
||||
def show_index_colors [] {
|
||||
let prefix = "38;5;"
|
||||
echo 1..256 | each {
|
||||
let cr = (echo (build-string $it % 16) | math eval)
|
||||
let color = (echo [(ansi -e $prefix) (build-string $it) 'm'] | str collect)
|
||||
let padded_number = (echo (build-string $it | str lpad -l 3 -c '0'))
|
||||
echo 1..256 | each { |idx|
|
||||
let cr = ($"($idx) % 16" | math eval)
|
||||
let color = ($"(ansi -e $prefix)($idx)m")
|
||||
let padded_number = ($"($idx)" | str lpad -l 3 -c '0')
|
||||
|
||||
if $cr == 0 {
|
||||
echo [$color $padded_number ' ' (char newline)]
|
||||
$"($color)($padded_number) (char newline)"
|
||||
} {
|
||||
echo [$color $padded_number ' ']
|
||||
$"($color)($padded_number) "
|
||||
}
|
||||
} | str collect
|
||||
}
|
||||
|
@ -21,4 +22,4 @@ show_index_colors
|
|||
# it all on one line which wraps in
|
||||
# your terminal
|
||||
|
||||
#echo 1..256 | each {echo [(ansi -e '38;5;') (build-string $it) 'm' (build-string $it) ' ']} | str collect
|
||||
#echo 1..256 | each { |idx| echo [(ansi -e '38;5;') (build-string $idx) 'm' (build-string $idx) ' ']} | str collect
|
|
@ -6,34 +6,24 @@
|
|||
# sys.stdout.write(u"\u001b[38;5;" + code + "m " + code.ljust(4))
|
||||
# print u"\u001b[0m"
|
||||
|
||||
|
||||
# Convert anything that's piped into it a string
|
||||
def 'to str' [] {
|
||||
each { build-string $it } | str collect
|
||||
}
|
||||
|
||||
# Foreground Colors
|
||||
echo 0..16 | each {
|
||||
let i = $it
|
||||
let row = (echo 0..16 | each {
|
||||
let j = $it
|
||||
let code = ($i * 16 + $j)
|
||||
echo 0..16 | each { |col|
|
||||
let row = (echo 0..16 | each { |row|
|
||||
let code = ($col * 16 + $row)
|
||||
if $code < 256 {
|
||||
echo [(ansi -e '38;5;') (echo $code | to str) 'm' (echo $code | to str | str lpad -l 4 -c ' ')] | str collect
|
||||
$"(ansi -e '38;5;')($code | into string)m($code | into string | str lpad -l 4 -c ' ')(ansi reset)"
|
||||
} {} # Do nothing in the else
|
||||
} | str collect)
|
||||
echo [$row (char newline)] | str collect
|
||||
$"($row)(char newline)"
|
||||
} | str collect
|
||||
|
||||
# Background Colors
|
||||
echo 0..16 | each {
|
||||
let i = $it
|
||||
let row = (echo 0..16 | each {
|
||||
let j = $it
|
||||
let code = ($i * 16 + $j)
|
||||
echo 0..16 | each { |col|
|
||||
let row = (echo 0..16 | each { |row|
|
||||
let code = ($col * 16 + $row)
|
||||
if $code < 256 {
|
||||
echo [(ansi -e '48;5;') (echo $code | to str) 'm' (echo $code | to str | str lpad -l 4 -c ' ') (ansi reset)] | str collect
|
||||
$"(ansi -e '48;5;')($code | into string)m($code | into string | str lpad -l 4 -c ' ')(ansi reset)"
|
||||
} {} # do nothing in the else
|
||||
} | str collect)
|
||||
echo [$row (char newline)] | str collect
|
||||
$"($row)(char newline)"
|
||||
} | str collect
|
||||
|
|
|
@ -3,31 +3,29 @@
|
|||
|
||||
# This prints the column headers
|
||||
let nl = (char newline)
|
||||
let plus = (echo [$nl ' + '] | str collect)
|
||||
let cols = (seq 0 35 | each { echo (build-string $it) | str lpad -c ' ' -l 3 } | str collect)
|
||||
echo [$plus $cols] | str collect
|
||||
let plus = $"($nl) + "
|
||||
let cols = (seq 0 35 | each { |col| $"($col)" | str lpad -c ' ' -l 3 } | str collect)
|
||||
$"($plus)($cols)"
|
||||
|
||||
let ansi_bg = (ansi -e '48;5;')
|
||||
let ansi_reset = (ansi reset)
|
||||
echo $nl $nl | str collect
|
||||
$"($nl)($nl)"
|
||||
|
||||
# This prints the row headers
|
||||
let row_header = ' 0 '
|
||||
let row_data = (seq 0 15 | each {
|
||||
build-string $ansi_bg $it 'm' ' ' $ansi_reset ' '
|
||||
let row_data = (seq 0 15 | each { |row|
|
||||
$"($ansi_bg)($row)m ($ansi_reset)"
|
||||
} | str collect)
|
||||
echo [$row_header $row_data $nl $nl] | str collect
|
||||
$"($row_header)($row_data)($nl)($nl)"
|
||||
|
||||
# This is the meat of the script that prints the little squares of color
|
||||
seq 0 6 | each {
|
||||
let math_str = (build-string $it ' * 36 + 16')
|
||||
let i = (echo $math_str | math eval)
|
||||
let row_header = (echo $i | str from -d 0 | str lpad -c ' ' -l 4)
|
||||
let row_data = (seq 0 35 | each {
|
||||
let math_str2 = (build-string $i + $it)
|
||||
let val = (echo $math_str2 | math eval | str from -d 0)
|
||||
echo [$ansi_bg $val 'm' ' ' (ansi -e 'm') ' ']
|
||||
seq 0 6 | each { |row_idx|
|
||||
let r = ($"($row_idx) * 36 + 16" | math eval)
|
||||
let row_header = (echo $r | str from -d 0 | str lpad -c ' ' -l 4)
|
||||
let row_data = (seq 0 35 | each { |row|
|
||||
let val = ($"($r + $row)" | math eval | str from -d 0)
|
||||
$"($ansi_bg)($val)m (ansi -e 'm') "
|
||||
} | str collect)
|
||||
build-string $row_header ' ' $row_data $nl $nl
|
||||
$"($row_header) ($row_data)($nl)($nl)"
|
||||
} | str collect
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# Background Colors
|
||||
echo 40..47 100..107 49 | each {
|
||||
let clbg = $it
|
||||
echo 40..47 100..107 49 | each { |clbg|
|
||||
# Foreground Colors
|
||||
echo 30..37 90..97 39 | each {
|
||||
let clfg = $it
|
||||
echo 30..37 90..97 39 | each { |clfg|
|
||||
# 0 Normal
|
||||
# 1 Bold or increased intensity
|
||||
# 2 Faint or decreased intensity
|
||||
|
@ -14,19 +12,14 @@ echo 40..47 100..107 49 | each {
|
|||
# 7 Reverse Video
|
||||
# 8 Conceal (not widely supported)
|
||||
# 9 Strike-through
|
||||
let row = (echo 0..9 | each {
|
||||
let attr = $it
|
||||
let ansi_str = (echo [(make-str $attr) ';' (make-str $clbg) ';' (make-str $clfg) 'm'] | str collect)
|
||||
echo [(ansi -e $ansi_str) ' ' $ansi_str ' ' (ansi reset)] | str collect
|
||||
let row = (echo 0..9 | each { |attr|
|
||||
let ansi_str = $"($attr);($clbg);($clfg)m"
|
||||
$"(ansi -e $ansi_str) ($ansi_str) (ansi reset)"
|
||||
} | str collect)
|
||||
echo [$row (char newline)] | str collect | autoview
|
||||
$"($row)(char newline)" | autoview
|
||||
} | str collect
|
||||
} | str collect
|
||||
|
||||
def make-str [item] {
|
||||
echo $item | str from
|
||||
}
|
||||
|
||||
# Bash Script
|
||||
# for clbg in {40..47} {100..107} 49 ; do
|
||||
# #Foreground
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
source ../stdlib_candidate/nu_style.nu
|
||||
|
||||
# # Regular Colors
|
||||
echo ' Regular Colors' (char newline) (char newline) | str collect
|
||||
$" Regular Colors (char newline) (char newline)"
|
||||
# | Value | Color |
|
||||
# | -------- | ------ |
|
||||
# | \e[0;30m | Black |
|
||||
|
@ -12,20 +12,20 @@ echo ' Regular Colors' (char newline) (char newline) | str collect
|
|||
# | \e[0;35m | Purple |
|
||||
# | \e[0;36m | Cyan |
|
||||
# | \e[0;37m | White |
|
||||
echo '| Value | Color | Name |' (char newline) | str collect
|
||||
echo '| ----- | ----- | --------- |' (char newline) | str collect
|
||||
echo '|' (fg_black) ' 0;30m ' (relet) '| ' Black ' | fg_black |' (char newline) | str collect
|
||||
echo '|' (fg_red) ' 0;31m ' (relet) '| ' Red ' | fg_red |' (char newline) | str collect
|
||||
echo '|' (fg_green) ' 0;32m ' (relet) '| ' Green ' | fg_green |' (char newline) | str collect
|
||||
echo '|' (fg_yellow) ' 0;33m ' (relet) '| ' Yellow ' | fg_yellow |' (char newline) | str collect
|
||||
echo '|' (fg_blue) ' 0;34m ' (relet) '| ' Blue ' | fg_blue |' (char newline) | str collect
|
||||
echo '|' (fg_purple) ' 0;35m ' (relet) '| ' Purple ' | fg_purple |' (char newline) | str collect
|
||||
echo '|' (fg_cyan) ' 0;36m ' (relet) '| ' Cyan ' | fg_cyan |' (char newline) | str collect
|
||||
echo '|' (fg_white) ' 0;37m ' (relet) '| ' White ' | fg_white |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | Name | (char newline)"
|
||||
$"| ----- | ----- | --------- | (char newline)"
|
||||
$"| (fg_black)0;30m(relet) | Black | fg_black | (char newline)"
|
||||
$"| (fg_red)0;31m(relet) | Red | fg_red | (char newline)"
|
||||
$"| (fg_green)0;32m(relet) | Green | fg_green | (char newline)"
|
||||
$"| (fg_yellow)0;33m(relet) | Yellow | fg_yellow | (char newline)"
|
||||
$"| (fg_blue)0;34m(relet) | Blue | fg_blue | (char newline)"
|
||||
$"| (fg_purple)0;35m(relet) | Purple | fg_purple | (char newline)"
|
||||
$"| (fg_cyan)0;36m(relet) | Cyan | fg_cyan | (char newline)"
|
||||
$"| (fg_white)0;37m(relet) | White | fg_white | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Bold
|
||||
echo ' Bold Colors' (char newline) (char newline) | str collect
|
||||
$" Bold Colors (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | -------- | -------- |
|
||||
|
@ -38,20 +38,20 @@ echo ' Bold Colors' (char newline) (char newline) | str collect
|
|||
# | \e[1;36m | Cyan |
|
||||
# | \e[1;37m | White |
|
||||
# | \e[1m | No Color |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (fg_black) (bold_on) ' 1;30m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (fg_red) (bold_on) ' 1;31m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (fg_green) (bold_on) ' 1;32m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (fg_yellow) (bold_on) ' 1;33m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (fg_blue) (bold_on) ' 1;34m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (fg_purple) (bold_on) ' 1;35m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (fg_cyan) (bold_on) ' 1;36m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (fg_white) (bold_on) ' 1;37m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (fg_black)(bold_on)1;30m(relet) | Black | (char newline)"
|
||||
$"| (fg_red)(bold_on)1;31m(relet) | Red | (char newline)"
|
||||
$"| (fg_green)(bold_on)1;32m(relet) | Green | (char newline)"
|
||||
$"| (fg_yellow)(bold_on)1;33m(relet) | Yellow | (char newline)"
|
||||
$"| (fg_blue)(bold_on)1;34m(relet) | Blue | (char newline)"
|
||||
$"| (fg_purple)(bold_on)1;35m(relet) | Purple | (char newline)"
|
||||
$"| (fg_cyan)(bold_on)1;36m(relet) | Cyan | (char newline)"
|
||||
$"| (fg_white)(bold_on)1;37m(relet) | White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Underline
|
||||
echo ' Underline Colors' (char newline) (char newline) | str collect
|
||||
$" Underline Colors (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | -------- | -------- |
|
||||
|
@ -64,20 +64,20 @@ echo ' Underline Colors' (char newline) (char newline) | str collect
|
|||
# | \e[4;36m | Cyan |
|
||||
# | \e[4;37m | White |
|
||||
# | \e[4m | No Color |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (fg_black) (underline_on) ' 4;30m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (fg_red) (underline_on) ' 4;31m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (fg_green) (underline_on) ' 4;32m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (fg_yellow) (underline_on) ' 4;33m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (fg_blue) (underline_on) ' 4;34m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (fg_purple) (underline_on) ' 4;35m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (fg_cyan) (underline_on) ' 4;36m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (fg_white) (underline_on) ' 4;37m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (fg_black)(underline_on)4;30m(relet) | Black | (char newline)"
|
||||
$"| (fg_red)(underline_on)4;31m(relet) | Red | (char newline)"
|
||||
$"| (fg_green)(underline_on)4;32m(relet) | Green | (char newline)"
|
||||
$"| (fg_yellow)(underline_on)4;33m(relet) | Yellow | (char newline)"
|
||||
$"| (fg_blue)(underline_on)4;34m(relet) | Blue | (char newline)"
|
||||
$"| (fg_purple)(underline_on)4;35m(relet) | Purple | (char newline)"
|
||||
$"| (fg_cyan)(underline_on)4;36m(relet) | Cyan | (char newline)"
|
||||
$"| (fg_white)(underline_on)4;37m(relet) | White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Background
|
||||
echo ' Background Colors' (char newline) (char newline) | str collect
|
||||
$" Background Colors (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | ------ | ------ |
|
||||
|
@ -89,17 +89,17 @@ echo ' Background Colors' (char newline) (char newline) | str collect
|
|||
# | \e[45m | Purple |
|
||||
# | \e[46m | Cyan |
|
||||
# | \e[47m | White |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (bg_black) ' 0;40m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (bg_red) ' 0;41m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (bg_green) ' 0;42m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (bg_yellow) ' 0;43m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (bg_blue) ' 0;44m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (bg_purple) ' 0;45m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (bg_cyan) ' 0;46m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (bg_white) ' 0;47m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (bg_black)0;40m(relet)| Black | (char newline)"
|
||||
$"| (bg_red)0;41m(relet)| Red | (char newline)"
|
||||
$"| (bg_green)0;42m(relet)| Green | (char newline)"
|
||||
$"| (bg_yellow)0;43m(relet)| Yellow | (char newline)"
|
||||
$"| (bg_blue)0;44m(relet)| Blue | (char newline)"
|
||||
$"| (bg_purple)0;45m(relet)| Purple | (char newline)"
|
||||
$"| (bg_cyan)0;46m(relet)| Cyan | (char newline)"
|
||||
$"| (bg_white)0;47m(relet)| White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Expand Background Horizontally
|
||||
|
||||
|
@ -108,7 +108,7 @@ echo (char newline)
|
|||
# | \e[K | No Color |
|
||||
|
||||
# # High Intensty
|
||||
echo ' High Intensity' (char newline) (char newline) | str collect
|
||||
$" High Intensity (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | -------- | ------ |
|
||||
|
@ -120,20 +120,20 @@ echo ' High Intensity' (char newline) (char newline) | str collect
|
|||
# | \e[0;95m | Purple |
|
||||
# | \e[0;96m | Cyan |
|
||||
# | \e[0;97m | White |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (fg_light_black) ' 0;90m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_red) ' 0;91m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_green) ' 0;92m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_yellow) ' 0;93m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_blue) ' 0;94m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_purple) ' 0;95m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_cyan) ' 0;96m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_white) ' 0;97m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (fg_light_black)0;90m(relet) | Black | (char newline)"
|
||||
$"| (fg_light_red)0;91m(relet) | Red | (char newline)"
|
||||
$"| (fg_light_green)0;92m(relet) | Green | (char newline)"
|
||||
$"| (fg_light_yellow)0;93m(relet) | Yellow | (char newline)"
|
||||
$"| (fg_light_blue)0;94m(relet) | Blue | (char newline)"
|
||||
$"| (fg_light_purple)0;95m(relet) | Purple | (char newline)"
|
||||
$"| (fg_light_cyan)0;96m(relet) | Cyan | (char newline)"
|
||||
$"| (fg_light_white)0;97m(relet) | White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Bold High Intensty
|
||||
echo ' Bold High Intensity' (char newline) (char newline) | str collect
|
||||
$" Bold High Intensity (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | -------- | ------ |
|
||||
|
@ -145,20 +145,20 @@ echo ' Bold High Intensity' (char newline) (char newline) | str collect
|
|||
# | \e[1;95m | Purple |
|
||||
# | \e[1;96m | Cyan |
|
||||
# | \e[1;97m | White |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (fg_light_black) (bold_on) ' 1;90m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_red) (bold_on) ' 1;91m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_green) (bold_on) ' 1;92m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_yellow) (bold_on) ' 1;93m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_blue) (bold_on) ' 1;94m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_purple) (bold_on) ' 1;95m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_cyan) (bold_on) ' 1;96m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (fg_light_white) (bold_on) ' 1;97m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (fg_light_black)(bold_on)1;90m(relet) | Black | (char newline)"
|
||||
$"| (fg_light_red)(bold_on)1;91m(relet) | Red | (char newline)"
|
||||
$"| (fg_light_green)(bold_on)1;92m(relet) | Green | (char newline)"
|
||||
$"| (fg_light_yellow)(bold_on)1;93m(relet) | Yellow | (char newline)"
|
||||
$"| (fg_light_blue)(bold_on)1;94m(relet) | Blue | (char newline)"
|
||||
$"| (fg_light_purple)(bold_on)1;95m(relet) | Purple | (char newline)"
|
||||
$"| (fg_light_cyan)(bold_on)1;96m(relet) | Cyan | (char newline)"
|
||||
$"| (fg_light_white)(bold_on)1;97m(relet) | White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # High Intensty backgrounds
|
||||
echo ' High Intensity backgrounds' (char newline) (char newline) | str collect
|
||||
$" High Intensity backgrounds (char newline) (char newline)"
|
||||
|
||||
# | Value | Color |
|
||||
# | --------- | ------ |
|
||||
|
@ -170,17 +170,17 @@ echo ' High Intensity backgrounds' (char newline) (char newline) | str collect
|
|||
# | \e[0;105m | Purple |
|
||||
# | \e[0;106m | Cyan |
|
||||
# | \e[0;107m | White |
|
||||
echo '| Value | Color |' (char newline) | str collect
|
||||
echo '| ----- | ----- |' (char newline) | str collect
|
||||
echo '|' (bg_light_black) ' 0;100m ' (relet) '| ' Black ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_red) ' 0;101m ' (relet) '| ' Red ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_green) ' 0;102m ' (relet) '| ' Green ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_yellow) ' 0;103m ' (relet) '| ' Yellow ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_blue) ' 0;104m ' (relet) '| ' Blue ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_purple) ' 0;105m ' (relet) '| ' Purple ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_cyan) ' 0;106m ' (relet) '| ' Cyan ' |' (char newline) | str collect
|
||||
echo '|' (bg_light_white) ' 0;107m ' (relet) '| ' White ' |' (char newline) | str collect
|
||||
echo (char newline)
|
||||
$"| Value | Color | (char newline)"
|
||||
$"| ----- | ----- | (char newline)"
|
||||
$"| (bg_light_black)0;100m(relet) | Black | (char newline)"
|
||||
$"| (bg_light_red)0;101m(relet) | Red | (char newline)"
|
||||
$"| (bg_light_green)0;102m(relet) | Green | (char newline)"
|
||||
$"| (bg_light_yellow)0;103m(relet) | Yellow | (char newline)"
|
||||
$"| (bg_light_blue)0;104m(relet) | Blue | (char newline)"
|
||||
$"| (bg_light_purple)0;105m(relet) | Purple | (char newline)"
|
||||
$"| (bg_light_cyan)0;106m(relet) | Cyan | (char newline)"
|
||||
$"| (bg_light_white)0;107m(relet) | White | (char newline)"
|
||||
char newline
|
||||
|
||||
# # Reset
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This is a first attempt and some type of logging
|
||||
def log [message:any] {
|
||||
let now = (date now | date format '%Y%m%d_%H%M%S.%f')
|
||||
let mess = (build-string $now '|DBG|' $message (char newline))
|
||||
let mess = $"($now)|DBG|($message)(char nl)"
|
||||
echo $mess | autoview
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue