@@ -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 {
@@ -48,6 +50,7 @@ impl Core {
4850 display : Display :: new ( inner_flags) ,
4951 colors : Colors :: new ( color_theme) ,
5052 icons : Icons :: new ( icon_theme) ,
53+ lscolors : LsColors :: from_env ( ) . unwrap_or_default ( ) ,
5154 }
5255 }
5356
@@ -122,14 +125,14 @@ impl Core {
122125
123126 if elem. file_type == FileType :: Directory {
124127 self . display . print_tree_row (
125- & elem. name . render ( & self . colors , & self . icons ) ,
128+ & elem. name . render ( & self . icons , & self . lscolors ) ,
126129 depth,
127130 last,
128131 ) ;
129132 self . run_inner ( vec ! [ elem. path] , depth + 1 ) ;
130133 } else {
131134 self . display . print_tree_row (
132- & elem. name . render ( & self . colors , & self . icons ) ,
135+ & elem. name . render ( & self . icons , & self . lscolors ) ,
133136 depth,
134137 last,
135138 ) ;
@@ -139,9 +142,9 @@ impl Core {
139142
140143 pub fn get_batch_outputs < ' b > ( & self , batch : & ' b Batch ) -> Vec < String > {
141144 if self . flags . display_long {
142- batch. get_long_output ( & self . colors , & self . icons , self . flags )
145+ batch. get_long_output ( & self . colors , & self . icons , self . flags , & self . lscolors )
143146 } else {
144- batch. get_short_output ( & self . colors , & self . icons , self . flags )
147+ batch. get_short_output ( & self . icons , self . flags , & self . lscolors )
145148 }
146149 }
147150
0 commit comments