File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- use color_thief:: { Color , ColorFormat } ;
2-
31use std:: path:: Path ;
42
5- fn find_color ( t : image:: ColorType ) -> ColorFormat {
3+ use color_thief:: { Color , ColorFormat , get_palette} ;
4+ use image:: ColorType ;
5+
6+ fn find_color ( t : ColorType ) -> ColorFormat {
67 match t {
7- image :: ColorType :: Rgb8 => ColorFormat :: Rgb ,
8- image :: ColorType :: Rgba8 => ColorFormat :: Rgba ,
8+ ColorType :: Rgb8 => ColorFormat :: Rgb ,
9+ ColorType :: Rgba8 => ColorFormat :: Rgba ,
910 _ => unreachable ! ( ) ,
1011 }
1112}
@@ -28,8 +29,7 @@ impl<'a> Image<'a> {
2829 match image:: open ( & self . resolved_path ( ) ) {
2930 Ok ( image) => {
3031 let color_type = find_color ( image. color ( ) ) ;
31- let colors =
32- color_thief:: get_palette ( & image. into_bytes ( ) , color_type, 10 , 10 ) . unwrap ( ) ;
32+ let colors = get_palette ( & image. into_bytes ( ) , color_type, 10 , 10 ) . unwrap ( ) ;
3333
3434 Some ( colors)
3535 }
You can’t perform that action at this time.
0 commit comments