1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-03 15:47:47 +00:00

Recover non-lemnos themes (#902)

Changes:

* Custom Nushell `color_config`'s (non-Lemnos) are moved to the
`./src/custom-nu-themes` directory and used to generate the main theme
files when doing a `./make.nu`
* `make.nu` and other scripts (e.g. preview) have been moved to the
`src` directory
* A separate `README` for the `src` scripts
* Main theme `README` updated for clarity
* Reordered the theme template, so all themes were regenerated. I'd like
to stop doing this ;-)

@amtoine Thanks for your suggestions on the `README`. I've pretty
extensively changed the flow, so please re-review and let me know how it
looks. Also note that I haven't personally tested with Nupm, so please
especially review this section. Thanks!

@fdncred CC

Still planning on working on the preview scripts next. They'll need only
slight changes to run (probably a path change), but they can be
simplified a bit now, I hope. At the same time, I'll complicate them in
other ways ;-).

Note that there is a bug in both `nushell-dark` and `nushell-light` that
prevented the terminal colors from being updated regardless. You can see
that in the existing screenshots, where both those themes simply re-use
the previous theme (alphabetically's) background. I haven't fixed this
yet.
This commit is contained in:
NotTheDr01ds 2024-07-19 14:27:05 -04:00 committed by GitHub
parent bd1ab4e7a7
commit 8557653047
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
465 changed files with 13091 additions and 11821 deletions

View file

@ -0,0 +1,119 @@
# Retrieve the theme settings
export def main [] { return {
separator: "#a9b1d6"
leading_trailing_space_bg: { attr: "n" }
header: { fg: "#9ece6a" attr: "b" }
empty: "#7aa2f7"
bool: {|| if $in { "#7dcfff" } else { "light_gray" } }
int: "#a9b1d6"
filesize: {|e|
if $e == 0b {
"#a9b1d6"
} else if $e < 1mb {
"#7dcfff"
} else {{ fg: "#7aa2f7" }}
}
duration: "#a9b1d6"
date: {|| (date now) - $in |
if $in < 1hr {
{ fg: "#f7768e" attr: "b" }
} else if $in < 6hr {
"#f7768e"
} else if $in < 1day {
"#e0af68"
} else if $in < 3day {
"#9ece6a"
} else if $in < 1wk {
{ fg: "#9ece6a" attr: "b" }
} else if $in < 6wk {
"#7dcfff"
} else if $in < 52wk {
"#7aa2f7"
} else { "dark_gray" }
}
range: "#a9b1d6"
float: "#a9b1d6"
string: "#a9b1d6"
nothing: "#a9b1d6"
binary: "#a9b1d6"
cellpath: "#a9b1d6"
row_index: { fg: "#9ece6a" attr: "b" }
record: "#a9b1d6"
list: "#a9b1d6"
block: "#a9b1d6"
hints: "dark_gray"
search_result: { fg: "#f7768e" bg: "#a9b1d6" }
shape_and: { fg: "#bb9af7" attr: "b" }
shape_binary: { fg: "#bb9af7" attr: "b" }
shape_block: { fg: "#7aa2f7" attr: "b" }
shape_bool: "#7dcfff"
shape_custom: "#9ece6a"
shape_datetime: { fg: "#7dcfff" attr: "b" }
shape_directory: "#7dcfff"
shape_external: "#7dcfff"
shape_externalarg: { fg: "#9ece6a" attr: "b" }
shape_filepath: "#7dcfff"
shape_flag: { fg: "#7aa2f7" attr: "b" }
shape_float: { fg: "#bb9af7" attr: "b" }
shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: "b" }
shape_globpattern: { fg: "#7dcfff" attr: "b" }
shape_int: { fg: "#bb9af7" attr: "b" }
shape_internalcall: { fg: "#7dcfff" attr: "b" }
shape_list: { fg: "#7dcfff" attr: "b" }
shape_literal: "#7aa2f7"
shape_match_pattern: "#9ece6a"
shape_matching_brackets: { attr: "u" }
shape_nothing: "#7dcfff"
shape_operator: "#e0af68"
shape_or: { fg: "#bb9af7" attr: "b" }
shape_pipe: { fg: "#bb9af7" attr: "b" }
shape_range: { fg: "#e0af68" attr: "b" }
shape_record: { fg: "#7dcfff" attr: "b" }
shape_redirection: { fg: "#bb9af7" attr: "b" }
shape_signature: { fg: "#9ece6a" attr: "b" }
shape_string: "#9ece6a"
shape_string_interpolation: { fg: "#7dcfff" attr: "b" }
shape_table: { fg: "#7aa2f7" attr: "b" }
shape_variable: "#bb9af7"
background: "#1a1b26"
foreground: "#c0caf5"
cursor: "#c0caf5"
}}
# Update the Nushell configuration
export def --env "set color_config" [] {
$env.config.color_config = (main)
}
# Update terminal colors
export def "update terminal" [] {
let theme = (main)
# Set terminal colors
let osc_screen_foreground_color = '10;'
let osc_screen_background_color = '11;'
let osc_cursor_color = '12;'
$"
(ansi -o $osc_screen_foreground_color)($theme.foreground)(char bel)
(ansi -o $osc_screen_background_color)($theme.background)(char bel)
(ansi -o $osc_cursor_color)($theme.cursor)(char bel)
"
# Line breaks above are just for source readability
# but create extra whitespace when activating. Collapse
# to one line
| str replace --all "\n" ''
| print $in
}
export module activate {
export-env {
set color_config
update terminal
}
}
# Activate the theme when sourced
use activate