@@ -29,6 +29,7 @@ pub struct Cli {
29
29
pub print_languages : bool ,
30
30
pub true_color : bool ,
31
31
pub art_off : bool ,
32
+ pub text_colors : Vec < String > ,
32
33
}
33
34
34
35
impl Cli {
@@ -38,7 +39,9 @@ impl Cli {
38
39
let possible_backends = [ "kitty" , "sixel" ] ;
39
40
#[ cfg( windows) ]
40
41
let possible_backends = [ ] ;
41
-
42
+ let color_values = & [
43
+ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12" , "13" , "14" , "15" ,
44
+ ] ;
42
45
let matches = App :: new ( crate_name ! ( ) )
43
46
. version ( crate_version ! ( ) )
44
47
. about ( crate_description ! ( ) )
@@ -107,12 +110,23 @@ impl Cli {
107
110
. value_name ( "X" )
108
111
. multiple ( true )
109
112
. takes_value ( true )
110
- . possible_values ( & [
111
- "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" , "11" , "12" , "13" , "14" ,
112
- "15" ,
113
- ] )
113
+ . possible_values ( color_values)
114
114
. help ( "Colors (X X X...) to print the ascii art." ) ,
115
115
)
116
+ . arg (
117
+ Arg :: with_name ( "text-colors" )
118
+ . short ( "t" )
119
+ . long ( "text-colors" )
120
+ . value_name ( "X" )
121
+ . multiple ( true )
122
+ . takes_value ( true )
123
+ . max_values ( 6 )
124
+ . possible_values ( color_values)
125
+ . help ( "Allows you to customize color of info lines (X X X...)" )
126
+ . long_help ( "Allows you to customize color of info lines. \
127
+ Goes in order of title, ~, underline, subtitle, colon, and info. \
128
+ Example: onefetch --text-colors 9 10 11 12 13 14")
129
+ )
116
130
. arg (
117
131
Arg :: with_name ( "no-bold" )
118
132
. long ( "no-bold" )
@@ -254,6 +268,12 @@ impl Cli {
254
268
Vec :: new ( )
255
269
} ;
256
270
271
+ let text_colors = if let Some ( values) = matches. values_of ( "text-colors" ) {
272
+ values. map ( String :: from) . collect ( )
273
+ } else {
274
+ Vec :: new ( )
275
+ } ;
276
+
257
277
let disabled_fields = info_fields:: get_disabled_fields ( fields_to_hide) ?;
258
278
259
279
let number_of_authors: usize = matches. value_of ( "authors-number" ) . unwrap ( ) . parse ( ) . unwrap ( ) ;
@@ -280,6 +300,7 @@ impl Cli {
280
300
excluded,
281
301
print_languages,
282
302
true_color,
303
+ text_colors,
283
304
art_off,
284
305
} )
285
306
}
0 commit comments