@@ -35,7 +35,7 @@ impl ProgressBarType {
3535}
3636
3737use crate :: {
38- args:: { Badge , ColorScheme , FolderStyle , Options , SetIconUsing } ,
38+ args:: { Badge , ColorScheme , FolderColor , FolderStyle , Options , SetIconUsing } ,
3939 command:: {
4040 run_command, run_magick, DEREZ_COMMAND , FILEICON_COMMAND , ICONUTIL_COMMAND ,
4141 OSASCRIPT_COMMAND , REZ_COMMAND , SETFILE_COMMAND , SIPS_COMMAND ,
@@ -72,6 +72,24 @@ struct MaskProfile {
7272 engraving : EngravingInputs ,
7373}
7474
75+ struct TintedPalette {
76+ fill : RGBColor ,
77+ top_bezel : RGBColor ,
78+ bottom_bezel : RGBColor ,
79+ }
80+
81+ fn tinted_palette (
82+ fill : [ u8 ; 3 ] ,
83+ top_bezel : [ u8 ; 3 ] ,
84+ bottom_bezel : [ u8 ; 3 ] ,
85+ ) -> TintedPalette {
86+ TintedPalette {
87+ fill : RGBColor :: from_components ( fill) ,
88+ top_bezel : RGBColor :: from_components ( top_bezel) ,
89+ bottom_bezel : RGBColor :: from_components ( bottom_bezel) ,
90+ }
91+ }
92+
7593#[ derive( Debug ) ]
7694pub struct WorkingDir {
7795 working_dir : Temp ,
@@ -244,40 +262,101 @@ impl IconResolution {
244262 }
245263}
246264
247- fn tahoe_mask_profile ( resolution : & IconResolution ) -> MaskProfile {
265+ fn tahoe_multicolor_mask_profile ( resolution : & IconResolution ) -> MaskProfile {
248266 let size = resolution. size ( ) ;
249267 MaskProfile {
250268 mask_dimensions : Dimensions {
251269 width : size * 3 / 4 ,
252270 height : size / 2 ,
253271 } ,
254- offset_y : resolution. offset_y ( ) - ( size as i32 / 160 ) ,
272+ offset_y : resolution. offset_y ( ) ,
255273 engraving : EngravingInputs {
256- fill_color : RGBColor :: new ( 52 , 104 , 148 ) ,
257- fill_opacity : 0.84 ,
274+ fill_color : RGBColor :: new ( 74 , 141 , 172 ) ,
275+ fill_opacity : 0.5 ,
258276 top_bezel : BezelInputs {
259- color : RGBColor :: new ( 48 , 96 , 136 ) ,
277+ color : RGBColor :: new ( 58 , 152 , 208 ) ,
260278 blur : BlurDown {
261279 spread_px : 0 ,
262- page_y : 1 ,
280+ page_y : 2 ,
263281 } ,
264- mask_operation : CompositingOperation :: Dst_Out ,
265- opacity : 0.18 ,
282+ mask_operation : CompositingOperation :: Dst_In ,
283+ opacity : 0.5 ,
266284 } ,
267285 bottom_bezel : BezelInputs {
268- color : RGBColor :: new ( 102 , 138 , 170 ) ,
286+ color : RGBColor :: new ( 174 , 225 , 253 ) ,
269287 blur : resolution. bottom_bezel_blur_down ( ) ,
270- mask_operation : CompositingOperation :: Dst_In ,
271- opacity : 0.2 ,
288+ mask_operation : CompositingOperation :: Dst_Out ,
289+ opacity : resolution . bottom_bezel_alpha ( ) ,
272290 } ,
273291 } ,
274292 }
275293}
276294
277- fn big_sur_mask_profile (
295+ fn tahoe_tinted_palette ( folder_color : FolderColor ) -> TintedPalette {
296+ match folder_color {
297+ FolderColor :: Multicolor => unreachable ! ( ) ,
298+ FolderColor :: Blue => {
299+ tinted_palette ( [ 14 , 117 , 243 ] , [ 10 , 92 , 201 ] , [ 50 , 131 , 255 ] )
300+ }
301+ FolderColor :: Graphite => {
302+ tinted_palette ( [ 129 , 128 , 133 ] , [ 104 , 103 , 108 ] , [ 142 , 141 , 147 ] )
303+ }
304+ FolderColor :: Green => {
305+ tinted_palette ( [ 44 , 195 , 68 ] , [ 27 , 156 , 49 ] , [ 68 , 207 , 86 ] )
306+ }
307+ FolderColor :: Orange => {
308+ tinted_palette ( [ 241 , 121 , 36 ] , [ 205 , 92 , 16 ] , [ 253 , 135 , 62 ] )
309+ }
310+ FolderColor :: Pink => {
311+ tinted_palette ( [ 240 , 25 , 73 ] , [ 205 , 12 , 54 ] , [ 252 , 55 , 92 ] )
312+ }
313+ FolderColor :: Purple => {
314+ tinted_palette ( [ 198 , 0 , 229 ] , [ 154 , 0 , 181 ] , [ 210 , 44 , 240 ] )
315+ }
316+ FolderColor :: Red => {
317+ tinted_palette ( [ 240 , 38 , 51 ] , [ 207 , 18 , 30 ] , [ 252 , 63 , 73 ] )
318+ }
319+ FolderColor :: Yellow => {
320+ tinted_palette ( [ 243 , 198 , 9 ] , [ 208 , 163 , 0 ] , [ 254 , 210 , 49 ] )
321+ }
322+ }
323+ }
324+
325+ fn tahoe_tinted_mask_profile (
278326 resolution : & IconResolution ,
279- color_scheme : ColorScheme ,
327+ folder_color : FolderColor ,
280328) -> MaskProfile {
329+ let size = resolution. size ( ) ;
330+ let palette = tahoe_tinted_palette ( folder_color) ;
331+ MaskProfile {
332+ mask_dimensions : Dimensions {
333+ width : size * 3 / 4 ,
334+ height : size / 2 ,
335+ } ,
336+ offset_y : resolution. offset_y ( ) - ( size as i32 / 160 ) ,
337+ engraving : EngravingInputs {
338+ fill_color : palette. fill ,
339+ fill_opacity : 0.5 ,
340+ top_bezel : BezelInputs {
341+ color : palette. top_bezel ,
342+ blur : BlurDown {
343+ spread_px : 0 ,
344+ page_y : 2 ,
345+ } ,
346+ mask_operation : CompositingOperation :: Dst_In ,
347+ opacity : 0.5 ,
348+ } ,
349+ bottom_bezel : BezelInputs {
350+ color : palette. bottom_bezel ,
351+ blur : resolution. bottom_bezel_blur_down ( ) ,
352+ mask_operation : CompositingOperation :: Dst_Out ,
353+ opacity : resolution. bottom_bezel_alpha ( ) ,
354+ } ,
355+ } ,
356+ }
357+ }
358+
359+ fn big_sur_mask_profile ( resolution : & IconResolution , color_scheme : ColorScheme ) -> MaskProfile {
281360 MaskProfile {
282361 mask_dimensions : Dimensions {
283362 width : resolution. size ( ) * 3 / 4 ,
@@ -433,9 +512,10 @@ impl IconConversion {
433512 ) ?;
434513
435514 self . step ( "Setting fill opacity" ) ;
436- let fill = self . simple_operation ( & fill_colorized, "2.2_FILL" , |args : & mut CommandArgs | {
437- args. opacity ( inputs. fill_opacity ) ;
438- } ) ?;
515+ let fill =
516+ self . simple_operation ( & fill_colorized, "2.2_FILL" , |args : & mut CommandArgs | {
517+ args. opacity ( inputs. fill_opacity ) ;
518+ } ) ?;
439519
440520 self . step ( "Complementing mask for top bezel" ) ;
441521 let top_bezel_complement = self . simple_operation (
@@ -562,9 +642,14 @@ impl IconConversion {
562642 // println!("[Starting] {}", inputs.resolution);
563643 // }
564644
565- let mask_profile = match icon_inputs. folder_style {
566- FolderStyle :: Tahoe => tahoe_mask_profile ( & icon_inputs. resolution ) ,
567- FolderStyle :: BigSur => {
645+ let mask_profile = match ( icon_inputs. folder_style , icon_inputs. folder_color ) {
646+ ( FolderStyle :: Tahoe , FolderColor :: Multicolor ) => {
647+ tahoe_multicolor_mask_profile ( & icon_inputs. resolution )
648+ }
649+ ( FolderStyle :: Tahoe , folder_color) => {
650+ tahoe_tinted_mask_profile ( & icon_inputs. resolution , folder_color)
651+ }
652+ ( FolderStyle :: BigSur , _) => {
568653 big_sur_mask_profile ( & icon_inputs. resolution , icon_inputs. color_scheme )
569654 }
570655 } ;
0 commit comments