@@ -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
@@ -118,14 +121,14 @@ impl Core {
118121
119122 if elem. file_type == FileType :: Directory {
120123 self . display . print_tree_row (
121- & elem. name . render ( & self . colors , & self . icons ) ,
124+ & elem. name . render ( & self . icons , & self . lscolors ) ,
122125 depth,
123126 last,
124127 ) ;
125128 self . run_inner ( vec ! [ elem. path] , depth + 1 ) ;
126129 } else {
127130 self . display . print_tree_row (
128- & elem. name . render ( & self . colors , & self . icons ) ,
131+ & elem. name . render ( & self . icons , & self . lscolors ) ,
129132 depth,
130133 last,
131134 ) ;
@@ -135,9 +138,9 @@ impl Core {
135138
136139 pub fn get_batch_outputs < ' b > ( & self , batch : & ' b Batch ) -> Vec < String > {
137140 if self . flags . display_long {
138- batch. get_long_output ( & self . colors , & self . icons , self . flags )
141+ batch. get_long_output ( & self . colors , & self . icons , self . flags , & self . lscolors )
139142 } else {
140- batch. get_short_output ( & self . colors , & self . icons , self . flags )
143+ batch. get_short_output ( & self . icons , self . flags , & self . lscolors )
141144 }
142145 }
143146
0 commit comments