1
Fork 0
mirror of https://github.com/RGBCube/ThemeNix synced 2025-07-28 08:57:46 +00:00

Fix visualization script

This commit is contained in:
RGBCube 2024-05-08 14:08:23 +03:00
parent 9f6d2cda4b
commit c188d0d729
No known key found for this signature in database
2 changed files with 13 additions and 17 deletions

View file

@ -50,18 +50,18 @@ def main [] {
mkdir themes mkdir themes
ls base16-schemes ls base16-schemes
| filter { | filter {
let extension = ($in.name | path parse | get extension) let extension = ($in.name | path parse | get extension)
$extension == "yml" or $extension == "yaml" $extension == "yml" or $extension == "yaml"
} }
| each { |it| | each { |it|
let new_path = "themes/" + ($it.name | path parse | get stem) + ".nix" 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 generate-valid-themes
} }

View file

@ -1,15 +1,11 @@
#!/usr/bin/env nu #!/usr/bin/env nu
def complete [] {
ls themes
}
# Visualizes a theme in the terminal. # Visualizes a theme in the terminal.
def main [ 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") { 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 let theme = open $theme
@ -24,8 +20,8 @@ def main [
let color_hex = "#" + $it.value let color_hex = "#" + $it.value
let color = { bg: $color_hex } 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)"
} }