From 74a0f09d7190da66f1d9a0c70685cab39b5ab19b Mon Sep 17 00:00:00 2001 From: RGBCube Date: Sat, 2 Dec 2023 23:59:30 +0300 Subject: [PATCH] Make visualize script better --- visualize.nu | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/visualize.nu b/visualize.nu index ca4101a..1e66a6a 100755 --- a/visualize.nu +++ b/visualize.nu @@ -15,18 +15,11 @@ def main [ $theme | reject name author - | transpose name value + | transpose key value | each { |it| - let hex = ("0x" + $in.value) | into int + let color = { bg: ("#" + $it.value) } - let r = $hex bit-shr 16 - let g = $hex bit-shr 8 bit-and 0xFF - let b = $hex bit-and 0xFF - - $it | merge { value: $"\\033[48;2;($r);($g);($b)m" } - } - | each { |it| - ^echo -e $"($it.name): ($it.value) \\033[0m" + echo $"($it.key): (ansi $color) (ansi reset)" } $"\n($theme.name) by ($theme.author)"