mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
Simplify default style and match Rust code to config (#9900)
# Description This PR aligns the default config in the Rust code to the default config in the nushell file. To do so, it removes closures from the default file, opting instead to pick a simple style as default. This allows easier maintenance of both Rust and Nushell code without removing the ability to use closures for styling in your configuration. The default theme is now "dark mode" in both the Rust and nushell config code. Obligatory screenshot: ![image](https://github.com/nushell/nushell/assets/547158/233b11af-3b81-4513-8a69-3e7b1cac3865) # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
This commit is contained in:
parent
ec4941c8ac
commit
840b4b854b
@ -143,13 +143,13 @@ impl<'a> StyleComputer<'a> {
|
||||
let mut map: StyleMapping = [
|
||||
("separator".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("leading_trailing_space_bg".to_string(), ComputableStyle::Static(Style::default().on(Color::Rgb(128, 128, 128)))),
|
||||
("header".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("empty".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("bool".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("header".to_string(), ComputableStyle::Static(Color::Green.bold())),
|
||||
("empty".to_string(), ComputableStyle::Static(Color::Blue.normal())),
|
||||
("bool".to_string(), ComputableStyle::Static(Color::LightCyan.normal())),
|
||||
("int".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("filesize".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("filesize".to_string(), ComputableStyle::Static(Color::Cyan.normal())),
|
||||
("duration".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("date".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("date".to_string(), ComputableStyle::Static(Color::Purple.normal())),
|
||||
("range".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("float".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
("string".to_string(), ComputableStyle::Static(Color::White.normal())),
|
||||
|
@ -14,33 +14,12 @@ let dark_theme = {
|
||||
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' } }
|
||||
# eg) {|| if $in { 'light_cyan' } else { 'light_gray' } }
|
||||
bool: light_cyan
|
||||
int: white
|
||||
filesize: {|e|
|
||||
if $e == 0b {
|
||||
'white'
|
||||
} else if $e < 1mb {
|
||||
'cyan'
|
||||
} else { 'blue' }
|
||||
}
|
||||
filesize: cyan
|
||||
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' }
|
||||
}
|
||||
date: purple
|
||||
range: white
|
||||
float: white
|
||||
string: white
|
||||
@ -98,33 +77,12 @@ let light_theme = {
|
||||
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' } }
|
||||
# eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } }
|
||||
bool: dark_cyan
|
||||
int: dark_gray
|
||||
filesize: {|e|
|
||||
if $e == 0b {
|
||||
'dark_gray'
|
||||
} else if $e < 1mb {
|
||||
'cyan_bold'
|
||||
} else { 'blue_bold' }
|
||||
}
|
||||
filesize: cyan_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' }
|
||||
}
|
||||
date: purple
|
||||
range: dark_gray
|
||||
float: dark_gray
|
||||
string: dark_gray
|
||||
@ -275,7 +233,7 @@ $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
|
||||
color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record
|
||||
use_grid_icons: true
|
||||
footer_mode: "25" # always, never, number_of_rows, auto
|
||||
float_precision: 2 # the precision for displaying floats in tables
|
||||
|
Loading…
Reference in New Issue
Block a user