nushell: Add light theme support

This commit is contained in:
2024-07-09 13:20:51 +02:00
parent 3a42637493
commit db737efb58
3 changed files with 180 additions and 167 deletions

View File

@ -6,173 +6,7 @@
# https://www.nushell.sh/book/coloring_and_theming.html
# And here is the theme collection
# https://github.com/nushell/nu_scripts/tree/main/themes
let dark_theme = {
# color for nushell primitives
separator: white
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: green_bold
empty: blue
# Closures can be used to choose colors for specific values.
# The value (in this case, a bool) is piped into the closure.
bool: {|| if $in { 'light_cyan' } else { 'light_gray' } }
int: white
filesize: {|e|
if $e == 0b {
'white'
} else if $e < 1mb {
'cyan'
} else { 'blue' }
}
duration: white
date: {|| (date now) - $in |
if $in < 1hr {
'purple'
} else if $in < 6hr {
'red'
} else if $in < 1day {
'yellow'
} else if $in < 3day {
'green'
} else if $in < 1wk {
'light_green'
} else if $in < 6wk {
'cyan'
} else if $in < 52wk {
'blue'
} else { 'dark_gray' }
}
range: white
float: white
string: white
nothing: white
binary: white
cellpath: white
row_index: green_bold
record: white
list: white
block: white
hints: dark_gray
search_result: {bg: red fg: white}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_closure: green_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: white bg: red attr: b}
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_match_pattern: green
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_table: blue_bold
shape_variable: purple
shape_vardecl: purple
}
let light_theme = {
# color for nushell primitives
separator: dark_gray
leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off
header: green_bold
empty: blue
# Closures can be used to choose colors for specific values.
# The value (in this case, a bool) is piped into the closure.
bool: {|| if $in { 'dark_cyan' } else { 'dark_gray' } }
int: dark_gray
filesize: {|e|
if $e == 0b {
'dark_gray'
} else if $e < 1mb {
'cyan_bold'
} else { 'blue_bold' }
}
duration: dark_gray
date: {|| (date now) - $in |
if $in < 1hr {
'purple'
} else if $in < 6hr {
'red'
} else if $in < 1day {
'yellow'
} else if $in < 3day {
'green'
} else if $in < 1wk {
'light_green'
} else if $in < 6wk {
'cyan'
} else if $in < 52wk {
'blue'
} else { 'dark_gray' }
}
range: dark_gray
float: dark_gray
string: dark_gray
nothing: dark_gray
binary: dark_gray
cellpath: dark_gray
row_index: green_bold
record: white
list: white
block: white
hints: dark_gray
search_result: {fg: white bg: red}
shape_and: purple_bold
shape_binary: purple_bold
shape_block: blue_bold
shape_bool: light_cyan
shape_closure: green_bold
shape_custom: green
shape_datetime: cyan_bold
shape_directory: cyan
shape_external: cyan
shape_externalarg: green_bold
shape_filepath: cyan
shape_flag: blue_bold
shape_float: purple_bold
# shapes are used to change the cli syntax highlighting
shape_garbage: { fg: white bg: red attr: b}
shape_globpattern: cyan_bold
shape_int: purple_bold
shape_internalcall: cyan_bold
shape_list: cyan_bold
shape_literal: blue
shape_match_pattern: green
shape_matching_brackets: { attr: u }
shape_nothing: light_cyan
shape_operator: yellow
shape_or: purple_bold
shape_pipe: purple_bold
shape_range: yellow_bold
shape_record: cyan_bold
shape_redirection: purple_bold
shape_signature: green_bold
shape_string: green
shape_string_interpolation: cyan_bold
shape_table: blue_bold
shape_variable: purple
shape_vardecl: purple
}
# Use fish for external completion
let fish_completer = {|spans|
@ -191,6 +25,8 @@ let fish_completer = {|spans|
| from tsv --flexible --no-infer
}
source theme.nu
$env.config = {
show_banner: false
@ -285,7 +121,8 @@ $env.config = {
vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
}
color_config: {} # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record
# sourced from theme.nu
color_config: $color_config
use_grid_icons: true
footer_mode: "25" # always, never, number_of_rows, auto
float_precision: 2 # the precision for displaying floats in tables

View File

@ -0,0 +1,175 @@
# gruvbox-dark
let dark_theme = {
separator: "#a89984"
leading_trailing_space_bg: { attr: "n" }
header: { fg: "#98971a" attr: "b" }
empty: "#458588"
bool: {|| if $in { "#8ec07c" } else { "light_gray" } }
int: "#a89984"
filesize: {|e|
if $e == 0b {
"#a89984"
} else if $e < 1mb {
"#689d6a"
} else {{ fg: "#458588" }}
}
duration: "#a89984"
date: {|| (date now) - $in |
if $in < 1hr {
{ fg: "#cc241d" attr: "b" }
} else if $in < 6hr {
"#cc241d"
} else if $in < 1day {
"#d79921"
} else if $in < 3day {
"#98971a"
} else if $in < 1wk {
{ fg: "#98971a" attr: "b" }
} else if $in < 6wk {
"#689d6a"
} else if $in < 52wk {
"#458588"
} else { "dark_gray" }
}
range: "#a89984"
float: "#a89984"
string: "#a89984"
nothing: "#a89984"
binary: "#a89984"
cellpath: "#a89984"
row_index: { fg: "#98971a" attr: "b" }
record: "#a89984"
list: "#a89984"
block: "#a89984"
hints: "dark_gray"
search_result: { fg: "#cc241d" bg: "#a89984" }
shape_and: { fg: "#b16286" attr: "b" }
shape_binary: { fg: "#b16286" attr: "b" }
shape_block: { fg: "#458588" attr: "b" }
shape_bool: "#8ec07c"
shape_custom: "#98971a"
shape_datetime: { fg: "#689d6a" attr: "b" }
shape_directory: "#689d6a"
shape_external: "#689d6a"
shape_externalarg: { fg: "#98971a" attr: "b" }
shape_filepath: "#689d6a"
shape_flag: { fg: "#458588" attr: "b" }
shape_float: { fg: "#b16286" attr: "b" }
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: "b" }
shape_globpattern: { fg: "#689d6a" attr: "b" }
shape_int: { fg: "#b16286" attr: "b" }
shape_internalcall: { fg: "#689d6a" attr: "b" }
shape_list: { fg: "#689d6a" attr: "b" }
shape_literal: "#458588"
shape_match_pattern: "#98971a"
shape_matching_brackets: { attr: "u" }
shape_nothing: "#8ec07c"
shape_operator: "#d79921"
shape_or: { fg: "#b16286" attr: "b" }
shape_pipe: { fg: "#b16286" attr: "b" }
shape_range: { fg: "#d79921" attr: "b" }
shape_record: { fg: "#689d6a" attr: "b" }
shape_redirection: { fg: "#b16286" attr: "b" }
shape_signature: { fg: "#98971a" attr: "b" }
shape_string: "#98971a"
shape_string_interpolation: { fg: "#689d6a" attr: "b" }
shape_table: { fg: "#458588" attr: "b" }
shape_variable: "#b16286"
background: "#282828"
foreground: "#ebdbb2"
cursor: "#ebdbb2"
}
# gruvbox-light-hard
let light_theme = {
separator: "#504945"
leading_trailing_space_bg: { attr: "n" }
header: { fg: "#79740e" attr: "b" }
empty: "#076678"
bool: {|| if $in { "#427b58" } else { "light_gray" } }
int: "#504945"
filesize: {|e|
if $e == 0b {
"#504945"
} else if $e < 1mb {
"#427b58"
} else {{ fg: "#076678" }}
}
duration: "#504945"
date: {|| (date now) - $in |
if $in < 1hr {
{ fg: "#9d0006" attr: "b" }
} else if $in < 6hr {
"#9d0006"
} else if $in < 1day {
"#b57614"
} else if $in < 3day {
"#79740e"
} else if $in < 1wk {
{ fg: "#79740e" attr: "b" }
} else if $in < 6wk {
"#427b58"
} else if $in < 52wk {
"#076678"
} else { "dark_gray" }
}
range: "#504945"
float: "#504945"
string: "#504945"
nothing: "#504945"
binary: "#504945"
cellpath: "#504945"
row_index: { fg: "#79740e" attr: "b" }
record: "#504945"
list: "#504945"
block: "#504945"
hints: "dark_gray"
search_result: { fg: "#9d0006" bg: "#504945" }
shape_and: { fg: "#8f3f71" attr: "b" }
shape_binary: { fg: "#8f3f71" attr: "b" }
shape_block: { fg: "#076678" attr: "b" }
shape_bool: "#427b58"
shape_custom: "#79740e"
shape_datetime: { fg: "#427b58" attr: "b" }
shape_directory: "#427b58"
shape_external: "#427b58"
shape_externalarg: { fg: "#79740e" attr: "b" }
shape_filepath: "#427b58"
shape_flag: { fg: "#076678" attr: "b" }
shape_float: { fg: "#8f3f71" attr: "b" }
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: "b" }
shape_globpattern: { fg: "#427b58" attr: "b" }
shape_int: { fg: "#8f3f71" attr: "b" }
shape_internalcall: { fg: "#427b58" attr: "b" }
shape_list: { fg: "#427b58" attr: "b" }
shape_literal: "#076678"
shape_match_pattern: "#79740e"
shape_matching_brackets: { attr: "u" }
shape_nothing: "#427b58"
shape_operator: "#b57614"
shape_or: { fg: "#8f3f71" attr: "b" }
shape_pipe: { fg: "#8f3f71" attr: "b" }
shape_range: { fg: "#b57614" attr: "b" }
shape_record: { fg: "#427b58" attr: "b" }
shape_redirection: { fg: "#8f3f71" attr: "b" }
shape_signature: { fg: "#79740e" attr: "b" }
shape_string: "#79740e"
shape_string_interpolation: { fg: "#427b58" attr: "b" }
shape_table: { fg: "#076678" attr: "b" }
shape_variable: "#8f3f71"
background: "#f9f5d7"
foreground: "#504945"
cursor: "#504945"
}
{% if light %}
let color_config = $light_theme
$env.LS_COLORS = (vivid generate gruvbox-light-hard | str trim)
{% else %}
let color_config = $dark_theme
$env.LS_COLORS = (vivid generate gruvbox-dark | str trim)
{% end %}