From 0a310cd9fa54e5c83ca55d8be856b90c55efe474 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 2 Jun 2021 17:47:16 -0500 Subject: [PATCH] add for to some scripts --- .gitignore | 1 + coloring/24bit-1.nu | 3 +-- coloring/color_tables.nu | 25 +++++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/coloring/24bit-1.nu b/coloring/24bit-1.nu index e3888ac..484840d 100644 --- a/coloring/24bit-1.nu +++ b/coloring/24bit-1.nu @@ -1,8 +1,7 @@ let term_cols = ((term size -w) - 1) # let's itertate through each of the columns of our terminal -echo 0..$term_cols | -each { |col| +for col inc 0..$term_cols { 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) diff --git a/coloring/color_tables.nu b/coloring/color_tables.nu index fa9f452..27018c3 100644 --- a/coloring/color_tables.nu +++ b/coloring/color_tables.nu @@ -10,13 +10,26 @@ # done # echo "" -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) " +# Nushell 0.32.0 +for x in 0..8 { + let row = (for i in 30..37 { + let row = (for a in 40..47 { + let color = $"($x);($i);($a)" + $"(ansi -e $color)m\e[($color)(ansi -e '0;37;40')m " } | str collect) $"($row)(char newline)" } | str collect) $"($row)(char newline)" -} | str collect \ No newline at end of file +} | str collect + +# Nushell 0.31.0 +# 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) +# $"($row)(char newline)" +# } | str collect) +# $"($row)(char newline)" +# } | str collect \ No newline at end of file