Skip to content

Commit

Permalink
add the preview script (nushell#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed May 17, 2023
1 parent 792d8e3 commit ac17502
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions themes/preview-current.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env nu

def main [] {
def preview [attr: string] {
let color = $in
$"(ansi -e {fg: $color attr: $attr})($color)(ansi reset)"
}

let colors = [
[normal rgb];

[black '#000000']
[red '#FF0000']
[green '#00FF00']
[yellow '#FFFF00']
[blue '#0000FF']
[magenta '#FF00FF']
[purple '#FF00FF']
[cyan '#00FFFF']
[white '#FFFFFF']
]

$colors | each {|color| {
dimmed: ($color.normal | preview d)
normal: ($color.normal | preview n)
bold: ($color.normal | preview b)

rgb_dimmed: ($color.rgb | preview d)
rgb_normal: ($color.rgb | preview n)
rgb_bold: ($color.rgb | preview b)
}}
}

0 comments on commit ac17502

Please sign in to comment.