mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
use LS_COLORS for directories
This commit is contained in:
+8
-2
@@ -1,8 +1,9 @@
|
||||
extern crate ansi_term;
|
||||
|
||||
use self::ansi_term::Colour::Fixed;
|
||||
use crate::utils::Node;
|
||||
|
||||
use lscolors::{LsColors, Style};
|
||||
|
||||
use terminal_size::{terminal_size, Height, Width};
|
||||
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
@@ -287,7 +288,12 @@ pub fn format_string(
|
||||
};
|
||||
|
||||
let pretty_size = if is_biggest && display_data.colors_on {
|
||||
format!("{}", Fixed(196).paint(pretty_size))
|
||||
let lscolors = LsColors::from_env().unwrap_or_default();
|
||||
let directory_color = lscolors.style_for_indicator(lscolors::Indicator::Directory);
|
||||
let ansi_style = directory_color
|
||||
.map(Style::to_ansi_term_style)
|
||||
.unwrap_or_default();
|
||||
format!("{}", ansi_style.paint(pretty_size))
|
||||
} else {
|
||||
pretty_size
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user