forked from nushell/nu_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython_index_table.nu
29 lines (27 loc) · 957 Bytes
/
python_index_table.nu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This is the python script
# import sys
# for i in range(0, 16):
# for j in range(0, 16):
# code = str(i * 16 + j)
# sys.stdout.write(u"\u001b[38;5;" + code + "m " + code.ljust(4))
# print u"\u001b[0m"
# Foreground Colors
echo 0..16 | each { |col|
let row = (echo 0..16 | each { |row|
let code = ($col * 16 + $row)
if $code < 256 {
$"(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)
$"($row)(char newline)"
} | str collect
# Background Colors
echo 0..16 | each { |col|
let row = (echo 0..16 | each { |row|
let code = ($col * 16 + $row)
if $code < 256 {
$"(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)
$"($row)(char newline)"
} | str collect