@@ -3,6 +3,7 @@ use color::{self, Colors};
33use display:: Display ;
44use flags:: { Flags , WhenFlag } ;
55use icon:: { self , Icons } ;
6+ use lscolors:: LsColors ;
67use meta:: { FileType , Meta } ;
78use std:: path:: { Path , PathBuf } ;
89use terminal_size:: terminal_size;
@@ -12,6 +13,7 @@ pub struct Core {
1213 icons : Icons ,
1314 display : Display ,
1415 colors : Colors ,
16+ lscolors : LsColors ,
1517}
1618
1719impl Core {
@@ -49,6 +51,7 @@ impl Core {
4951 display : Display :: new ( inner_flags) ,
5052 colors : Colors :: new ( color_theme) ,
5153 icons : Icons :: new ( icon_theme) ,
54+ lscolors : LsColors :: from_env ( ) . unwrap_or_default ( ) ,
5255 }
5356 }
5457
@@ -124,14 +127,14 @@ impl Core {
124127
125128 if elem. file_type == FileType :: Directory {
126129 output += & self . display . print_tree_row (
127- & elem. name . render ( & self . colors , & self . icons ) ,
130+ & elem. name . render ( & self . icons , & self . lscolors ) ,
128131 depth,
129132 last,
130133 ) ;
131134 self . run_inner ( vec ! [ elem. path] , depth + 1 ) ;
132135 } else {
133136 output += & self . display . print_tree_row (
134- & elem. name . render ( & self . colors , & self . icons ) ,
137+ & elem. name . render ( & self . icons , & self . lscolors ) ,
135138 depth,
136139 last,
137140 ) ;
@@ -143,9 +146,9 @@ impl Core {
143146
144147 pub fn get_batch_outputs < ' b > ( & self , batch : & ' b Batch ) -> Vec < String > {
145148 if self . flags . display_long {
146- batch. get_long_output ( & self . colors , & self . icons , self . flags )
149+ batch. get_long_output ( & self . colors , & self . icons , self . flags , & self . lscolors )
147150 } else {
148- batch. get_short_output ( & self . colors , & self . icons , self . flags )
151+ batch. get_short_output ( & self . icons , self . flags , & self . lscolors )
149152 }
150153 }
151154
0 commit comments