diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index d9d61eff0b..0d342cfb0b 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -1056,7 +1056,28 @@ fn render_path_name( && has_metadata && config.shell_integration.osc8; - let ansi_style = style.map(Style::to_nu_ansi_term_style).unwrap_or_default(); + // If there is no style at all set it to use 'default' foreground and background + // colors. This prevents it being colored in tabled as string colors. + // To test this: + // $env.LS_COLORS = 'fi=0' + // $env.config.color_config.string = 'red' + // if a regular file without an extension is the color 'default' then it's working + // if a regular file without an extension is the color 'red' then it's not working + let ansi_style = style + .map(Style::to_nu_ansi_term_style) + .unwrap_or(nu_ansi_term::Style { + foreground: Some(nu_ansi_term::Color::Default), + background: Some(nu_ansi_term::Color::Default), + is_bold: false, + is_dimmed: false, + is_italic: false, + is_underline: false, + is_blink: false, + is_reverse: false, + is_hidden: false, + is_strikethrough: false, + prefix_with_reset: false, + }); let full_path = PathBuf::from(stripped_path.as_ref()) .canonicalize()