From 9b2a022f5b41aad69d87545bae00d725a2fac09f Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sun, 20 Feb 2022 16:05:36 -0600 Subject: [PATCH] tweak default config to amplify theme-ability (#4572) * tweak default config to amplify theme-ability * missed default of auto --- crates/nu-color-config/src/color_config.rs | 18 +++---- src/default_config.nu | 60 +++++++++++++++++----- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/crates/nu-color-config/src/color_config.rs b/crates/nu-color-config/src/color_config.rs index 459095cadf..0bef0d6ec5 100644 --- a/crates/nu-color-config/src/color_config.rs +++ b/crates/nu-color-config/src/color_config.rs @@ -185,7 +185,7 @@ pub fn get_color_config(config: &Config) -> HashMap { // hm.insert("primitive_line".to_string(), Color::White.normal()); // hm.insert("primitive_pattern".to_string(), Color::White.normal()); // hm.insert("primitive_path".to_string(), Color::White.normal()); - // hm.insert("separator_color".to_string(), Color::White.normal()); + hm.insert("separator".to_string(), Color::White.normal()); hm.insert( "leading_trailing_space_bg".to_string(), Style::default().on(Color::Rgb(128, 128, 128)), @@ -292,14 +292,6 @@ pub fn style_primitive(primitive: &str, color_hm: &HashMap) -> Te } } - "record" | "list" | "block" => { - let style = color_hm.get(primitive); - match style { - Some(s) => TextStyle::with_style(Alignment::Left, *s), - None => TextStyle::basic_left(), - } - } - "nothing" => { let style = color_hm.get(primitive); match style { @@ -337,6 +329,14 @@ pub fn style_primitive(primitive: &str, color_hm: &HashMap) -> Te } } + "record" | "list" | "block" => { + let style = color_hm.get(primitive); + match style { + Some(s) => TextStyle::with_style(Alignment::Left, *s), + None => TextStyle::basic_left(), + } + } + // types in nushell but not in engine-q // "Line" => { // let style = color_hm.get("Primitive::Line"); diff --git a/src/default_config.nu b/src/default_config.nu index 308f2e79dd..69577768a6 100644 --- a/src/default_config.nu +++ b/src/default_config.nu @@ -107,32 +107,66 @@ extern "git push" [ --ipv6(-6) # use IPv6 addresses only ] -# The default config record. This is where much of your global configuration is setup. -let $config = { - filesize_metric: $false - table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other - use_ls_colors: $true - rm_always_trash: $false - color_config: { +# for more information on themes see +# https://github.com/nushell/nushell/blob/main/docs/How_To_Coloring_and_Theming.md +let default_theme = { + # color for nushell primitives separator: white leading_trailing_space_bg: white header: green_bold - date: white - filesize: white - row_index: green_bold - hints: dark_gray + empty: blue bool: white int: white + filesize: white duration: white + date: white 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 + + # flatshapes are used to change the cli syntax highlighting + flatshape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} + flatshape_bool: light_cyan + flatshape_int: purple_bold + flatshape_float: purple_bold + flatshape_range: yellow_bold + flatshape_internalcall: cyna_bold + flatshape_external: cyan + flatshape_externalarg: green_bold + flatshape_literal: blue + flatshape_operator: yellow + flatshape_signature: green_bold + flatshape_string: green + flatshape_string_interpolation: cyan_bold + flatshape_list: cyan_bold + flatshape_table: blue_bold + flatshape_record: cyan_bold + flatshape_block: blue_bold + flatshape_filepath: cyan + flatshape_globpattern: cyan_bold + flatshape_variable: purple + flatshape_flag: blue_bold + flatshape_custom: green + flatshape_nothing: light_cyan +} + +# The default config record. This is where much of your global configuration is setup. +let $config = { + filesize_metric: $false + table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other + use_ls_colors: $true + rm_always_trash: $false + color_config: $default_theme use_grid_icons: $true - footer_mode: "30" # always, never, number_of_rows, auto + footer_mode: "25" # always, never, number_of_rows, auto quick_completions: $true # set this to $false to prevent auto-selecting completions when only one remains animate_prompt: $false # redraw the prompt every second float_precision: 2