mirror of
https://github.com/RGBCube/ThemeNix
synced 2025-07-27 00:17:45 +00:00
27 lines
640 B
Text
Executable file
27 lines
640 B
Text
Executable file
#!/usr/bin/env nu
|
|
|
|
# Visualizes a theme in the terminal.
|
|
def main [
|
|
theme: string # The path to the theme to visualize.
|
|
] {
|
|
if not ($env.COLORTERM | str contains "truecolor") {
|
|
print "your terminal emulator doesn't support truecolor, colors may be wrong\n"
|
|
}
|
|
|
|
let theme = open $theme
|
|
| str replace --all ";" ","
|
|
| str replace --all "=" ":"
|
|
| from json
|
|
|
|
$theme
|
|
| reject name author
|
|
| transpose key value
|
|
| each {|it|
|
|
let color_hex = "#" + $it.value
|
|
let color = { bg: $color_hex }
|
|
|
|
print $"($it.key) ($color_hex): (ansi $color) (ansi reset)"
|
|
}
|
|
|
|
print $"\n($theme.name) by ($theme.author)"
|
|
}
|