Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update theme preview scripts and screenshots #909

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 56 additions & 8 deletions themes/src/preview-theme.nu → themes/mod.nu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Preview the current nushell theme
def preview_theme [] {
export def "preview theme" [] {
let ansi_names = (ansi --list | get name)
let all_ansi_names = $ansi_names ++ (ansi --list | get 'short name' | range 133..388)
let color_config = ($env.config.color_config | transpose key value)
Expand Down Expand Up @@ -64,7 +64,7 @@ def preview_small [theme: string@"nu-complete list themes"] {
}

# Preview the current nushell theme, small mode
def preview_theme_small [] {
export def "preview theme small" [] {
let ansi_names = (ansi --list | get name)
let all_ansi_names = $ansi_names ++ (ansi --list | get 'short name' | range 133..388)
let color_config = ($env.config.color_config | transpose key value)
Expand All @@ -86,6 +86,8 @@ def preview_theme_small [] {
} else {
[[key]; [$source_code_replaced]]
}
} else if ($row.key == 'background') {
[[key]; [$"($row.key) - ($row.value)"]]
} else if ($row.value | describe | str contains 'record') {
[[key]; [$"(ansi ($row.value))($row.key) - ($row.value)(ansi reset)"]]
} else if ($row.value | str starts-with '#') {
Expand All @@ -103,10 +105,56 @@ def preview_theme_small [] {
# echo $table1 | merge $table2

# This draws the table with three tables merged
let row_count = ($color_table | length)
let row_count_third = (($color_table | length) / 3 | math floor)
let table1 = ($color_table | range 0..$row_count_third | rename key1 val1)
let table2 = ($color_table | range $row_count_third..($row_count_third * 2) | rename key2 val2)
let table3 = ($color_table | range ($row_count_third * 2)..$row_count | rename key3 val3)
echo $table1 | merge $table2 | merge $table3
let row_count = (
$color_table
| length
| $in / 3
| math ceil
)

#return ($color_table | group 19)

let table1 = ($color_table | group $row_count | get 0 | rename "Column 1")
let table2 = ($color_table | group $row_count | get 1 | rename "Column 2")
let table3 = ($color_table | group $row_count | get 2 | rename "Column 3")

$table1
| merge $table2
| merge $table3
| default '' "Column 3"
| table -e -i false
# Remove heading
| str replace -r '^([^\n]+)(\n[^\n]+){2}' '$1'
}

# Preview what your terminal theme looks like
export def 'preview terminal' [] {
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)
}}
}
2 changes: 1 addition & 1 deletion themes/nu-themes/3024-day.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a5a2a2'
nothing: '#a5a2a2'
binary: '#a5a2a2'
cellpath: '#a5a2a2'
cell-path: '#a5a2a2'
row_index: { fg: '#01a252' attr: 'b' }
record: '#a5a2a2'
list: '#a5a2a2'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/3024-night.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a5a2a2'
nothing: '#a5a2a2'
binary: '#a5a2a2'
cellpath: '#a5a2a2'
cell-path: '#a5a2a2'
row_index: { fg: '#01a252' attr: 'b' }
record: '#a5a2a2'
list: '#a5a2a2'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/3024.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a5a2a2'
nothing: '#a5a2a2'
binary: '#a5a2a2'
cellpath: '#a5a2a2'
cell-path: '#a5a2a2'
row_index: { fg: '#01a252' attr: 'b' }
record: '#a5a2a2'
list: '#a5a2a2'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/abyss.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a0cce2'
nothing: '#a0cce2'
binary: '#a0cce2'
cellpath: '#a0cce2'
cell-path: '#a0cce2'
row_index: { fg: '#10598b' attr: 'b' }
record: '#a0cce2'
list: '#a0cce2'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/aci.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#b6b6b6'
nothing: '#b6b6b6'
binary: '#b6b6b6'
cellpath: '#b6b6b6'
cell-path: '#b6b6b6'
row_index: { fg: '#83ff08' attr: 'b' }
record: '#b6b6b6'
list: '#b6b6b6'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/aco.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#bebebe'
nothing: '#bebebe'
binary: '#bebebe'
cellpath: '#bebebe'
cell-path: '#bebebe'
row_index: { fg: '#83ff08' attr: 'b' }
record: '#bebebe'
list: '#bebebe'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/adventuretime.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#f8dcc0'
nothing: '#f8dcc0'
binary: '#f8dcc0'
cellpath: '#f8dcc0'
cell-path: '#f8dcc0'
row_index: { fg: '#4ab118' attr: 'b' }
record: '#f8dcc0'
list: '#f8dcc0'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/afterglow.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#d0d0d0'
nothing: '#d0d0d0'
binary: '#d0d0d0'
cellpath: '#d0d0d0'
cell-path: '#d0d0d0'
row_index: { fg: '#7b9246' attr: 'b' }
record: '#d0d0d0'
list: '#d0d0d0'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/alien-blood.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#647d75'
nothing: '#647d75'
binary: '#647d75'
cellpath: '#647d75'
cell-path: '#647d75'
row_index: { fg: '#2f7e25' attr: 'b' }
record: '#647d75'
list: '#647d75'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/alucard.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#bbbbbb'
nothing: '#bbbbbb'
binary: '#bbbbbb'
cellpath: '#bbbbbb'
cell-path: '#bbbbbb'
row_index: { fg: '#fa0074' attr: 'b' }
record: '#bbbbbb'
list: '#bbbbbb'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/amora.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#dedbeb'
nothing: '#dedbeb'
binary: '#dedbeb'
cellpath: '#dedbeb'
cell-path: '#dedbeb'
row_index: { fg: '#a2baa8' attr: 'b' }
record: '#dedbeb'
list: '#dedbeb'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/apathy.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#81b5ac'
nothing: '#81b5ac'
binary: '#81b5ac'
cellpath: '#81b5ac'
cell-path: '#81b5ac'
row_index: { fg: '#883e96' attr: 'b' }
record: '#81b5ac'
list: '#81b5ac'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/apprentice.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#bcbcbc'
nothing: '#bcbcbc'
binary: '#bcbcbc'
cellpath: '#bcbcbc'
cell-path: '#bcbcbc'
row_index: { fg: '#87af87' attr: 'b' }
record: '#bcbcbc'
list: '#bcbcbc'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/argonaut.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#ffffff'
nothing: '#ffffff'
binary: '#ffffff'
cellpath: '#ffffff'
cell-path: '#ffffff'
row_index: { fg: '#8ce10b' attr: 'b' }
record: '#ffffff'
list: '#ffffff'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/arthur.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#bbaa99'
nothing: '#bbaa99'
binary: '#bbaa99'
cellpath: '#bbaa99'
cell-path: '#bbaa99'
row_index: { fg: '#86af80' attr: 'b' }
record: '#bbaa99'
list: '#bbaa99'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/ashes.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#c7ccd1'
nothing: '#c7ccd1'
binary: '#c7ccd1'
cellpath: '#c7ccd1'
cell-path: '#c7ccd1'
row_index: { fg: '#95c7ae' attr: 'b' }
record: '#c7ccd1'
list: '#c7ccd1'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-cave-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#585260'
nothing: '#585260'
binary: '#585260'
cellpath: '#585260'
cell-path: '#585260'
row_index: { fg: '#2a9292' attr: 'b' }
record: '#585260'
list: '#585260'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-cave.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#8b8792'
nothing: '#8b8792'
binary: '#8b8792'
cellpath: '#8b8792'
cell-path: '#8b8792'
row_index: { fg: '#2a9292' attr: 'b' }
record: '#8b8792'
list: '#8b8792'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-dune-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#6e6b5e'
nothing: '#6e6b5e'
binary: '#6e6b5e'
cellpath: '#6e6b5e'
cell-path: '#6e6b5e'
row_index: { fg: '#60ac39' attr: 'b' }
record: '#6e6b5e'
list: '#6e6b5e'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-dune.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a6a28c'
nothing: '#a6a28c'
binary: '#a6a28c'
cellpath: '#a6a28c'
cell-path: '#a6a28c'
row_index: { fg: '#60ac39' attr: 'b' }
record: '#a6a28c'
list: '#a6a28c'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-estuary-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#5f5e4e'
nothing: '#5f5e4e'
binary: '#5f5e4e'
cellpath: '#5f5e4e'
cell-path: '#5f5e4e'
row_index: { fg: '#7d9726' attr: 'b' }
record: '#5f5e4e'
list: '#5f5e4e'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-estuary.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#929181'
nothing: '#929181'
binary: '#929181'
cellpath: '#929181'
cell-path: '#929181'
row_index: { fg: '#7d9726' attr: 'b' }
record: '#929181'
list: '#929181'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-forest-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#68615e'
nothing: '#68615e'
binary: '#68615e'
cellpath: '#68615e'
cell-path: '#68615e'
row_index: { fg: '#7b9726' attr: 'b' }
record: '#68615e'
list: '#68615e'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-forest.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#a8a19f'
nothing: '#a8a19f'
binary: '#a8a19f'
cellpath: '#a8a19f'
cell-path: '#a8a19f'
row_index: { fg: '#7b9726' attr: 'b' }
record: '#a8a19f'
list: '#a8a19f'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-heath-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#695d69'
nothing: '#695d69'
binary: '#695d69'
cellpath: '#695d69'
cell-path: '#695d69'
row_index: { fg: '#918b3b' attr: 'b' }
record: '#695d69'
list: '#695d69'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-heath.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#ab9bab'
nothing: '#ab9bab'
binary: '#ab9bab'
cellpath: '#ab9bab'
cell-path: '#ab9bab'
row_index: { fg: '#918b3b' attr: 'b' }
record: '#ab9bab'
list: '#ab9bab'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-lakeside-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#516d7b'
nothing: '#516d7b'
binary: '#516d7b'
cellpath: '#516d7b'
cell-path: '#516d7b'
row_index: { fg: '#568c3b' attr: 'b' }
record: '#516d7b'
list: '#516d7b'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-lakeside.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#7ea2b4'
nothing: '#7ea2b4'
binary: '#7ea2b4'
cellpath: '#7ea2b4'
cell-path: '#7ea2b4'
row_index: { fg: '#568c3b' attr: 'b' }
record: '#7ea2b4'
list: '#7ea2b4'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-plateau-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#585050'
nothing: '#585050'
binary: '#585050'
cellpath: '#585050'
cell-path: '#585050'
row_index: { fg: '#4b8b8b' attr: 'b' }
record: '#585050'
list: '#585050'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-plateau.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#8a8585'
nothing: '#8a8585'
binary: '#8a8585'
cellpath: '#8a8585'
cell-path: '#8a8585'
row_index: { fg: '#4b8b8b' attr: 'b' }
record: '#8a8585'
list: '#8a8585'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-savanna-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#526057'
nothing: '#526057'
binary: '#526057'
cellpath: '#526057'
cell-path: '#526057'
row_index: { fg: '#489963' attr: 'b' }
record: '#526057'
list: '#526057'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-savanna.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#87928a'
nothing: '#87928a'
binary: '#87928a'
cellpath: '#87928a'
cell-path: '#87928a'
row_index: { fg: '#489963' attr: 'b' }
record: '#87928a'
list: '#87928a'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-seaside-light.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#5e6e5e'
nothing: '#5e6e5e'
binary: '#5e6e5e'
cellpath: '#5e6e5e'
cell-path: '#5e6e5e'
row_index: { fg: '#29a329' attr: 'b' }
record: '#5e6e5e'
list: '#5e6e5e'
Expand Down
2 changes: 1 addition & 1 deletion themes/nu-themes/atelier-seaside.nu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export def main [] {
string: '#8ca68c'
nothing: '#8ca68c'
binary: '#8ca68c'
cellpath: '#8ca68c'
cell-path: '#8ca68c'
row_index: { fg: '#29a329' attr: 'b' }
record: '#8ca68c'
list: '#8ca68c'
Expand Down
Loading