From c188d0d729841f71f576dfb544e70c0340bf52a8 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 8 May 2024 14:08:23 +0300 Subject: [PATCH] Fix visualization script --- generate-themes.nu | 18 +++++++++--------- visualize.nu | 12 ++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/generate-themes.nu b/generate-themes.nu index 34af722..0ed1b2e 100755 --- a/generate-themes.nu +++ b/generate-themes.nu @@ -50,18 +50,18 @@ def main [] { mkdir themes ls base16-schemes - | filter { - let extension = ($in.name | path parse | get extension) + | filter { + let extension = ($in.name | path parse | get extension) - $extension == "yml" or $extension == "yaml" - } - | each { |it| - let new_path = "themes/" + ($it.name | path parse | get stem) + ".nix" + $extension == "yml" or $extension == "yaml" + } + | each { |it| + let new_path = "themes/" + ($it.name | path parse | get stem) + ".nix" - echo $"converting ($it.name) to ($new_path)..." + echo $"converting ($it.name) to ($new_path)..." - theme-to-nix (open $it.name) | save $new_path - } + theme-to-nix (open $it.name) | save $new_path + } generate-valid-themes } diff --git a/visualize.nu b/visualize.nu index a59e071..80e4691 100755 --- a/visualize.nu +++ b/visualize.nu @@ -1,15 +1,11 @@ #!/usr/bin/env nu -def complete [] { - ls themes -} - # Visualizes a theme in the terminal. def main [ - theme: string@complete # The path to the theme to visualize. + theme: string # The path to the theme to visualize. ] { if not ($env.COLORTERM | str contains "truecolor") { - echo "your terminal emulator doesn't support truecolor, colors may be wrong\n" + print "your terminal emulator doesn't support truecolor, colors may be wrong\n" } let theme = open $theme @@ -24,8 +20,8 @@ def main [ let color_hex = "#" + $it.value let color = { bg: $color_hex } - echo $"($it.key) ($color_hex): (ansi $color) (ansi reset)" + print $"($it.key) ($color_hex): (ansi $color) (ansi reset)" } - $"\n($theme.name) by ($theme.author)" + print $"\n($theme.name) by ($theme.author)" }