@@ -29,8 +29,8 @@ pub struct Info {
29
29
number_of_tags : usize ,
30
30
number_of_branches : usize ,
31
31
license : String ,
32
- pub colors : Vec < Color > ,
33
- pub color_set : TextColor ,
32
+ pub ascii_colors : Vec < Color > ,
33
+ pub text_colors : TextColor ,
34
34
pub config : Cli ,
35
35
}
36
36
@@ -42,14 +42,14 @@ impl std::fmt::Display for Info {
42
42
writeln ! (
43
43
f,
44
44
"{} {} {}" ,
45
- & self . bold( & self . git_username) . color( self . color_set . title) ,
46
- & self . bold( "~" ) . color( self . color_set . tilde) ,
47
- & self . bold( & self . git_version) . color( self . color_set . title)
45
+ & self . bold( & self . git_username) . color( self . text_colors . title) ,
46
+ & self . bold( "~" ) . color( self . text_colors . tilde) ,
47
+ & self . bold( & self . git_version) . color( self . text_colors . title)
48
48
) ?;
49
49
50
50
let separator = "-" . repeat ( git_info_length) ;
51
51
52
- writeln ! ( f, "{}" , separator. color( self . color_set . underline) ) ?;
52
+ writeln ! ( f, "{}" , separator. color( self . text_colors . underline) ) ?;
53
53
}
54
54
55
55
if !self . config . disabled_fields . project {
@@ -61,8 +61,8 @@ impl std::fmt::Display for Info {
61
61
f,
62
62
"{}{} {}" ,
63
63
project_str,
64
- self . project_name. color( self . color_set . info) ,
65
- branches_tags_str. color( self . color_set . info)
64
+ self . project_name. color( self . text_colors . info) ,
65
+ branches_tags_str. color( self . text_colors . info)
66
66
) ?;
67
67
}
68
68
@@ -71,7 +71,7 @@ impl std::fmt::Display for Info {
71
71
f,
72
72
"{}{}" ,
73
73
& self . get_formatted_subtitle_label( "HEAD" ) ,
74
- & self . current_commit. to_string( ) . color( self . color_set . info) ,
74
+ & self . current_commit. to_string( ) . color( self . text_colors . info) ,
75
75
) ?;
76
76
}
77
77
@@ -80,7 +80,7 @@ impl std::fmt::Display for Info {
80
80
f,
81
81
"{}{}" ,
82
82
& self . get_formatted_subtitle_label( "Pending" ) ,
83
- & self . pending. color( self . color_set . info) ,
83
+ & self . pending. color( self . text_colors . info) ,
84
84
) ?;
85
85
}
86
86
@@ -89,7 +89,7 @@ impl std::fmt::Display for Info {
89
89
f,
90
90
"{}{}" ,
91
91
& self . get_formatted_subtitle_label( "Version" ) ,
92
- & self . version. color( self . color_set . info) ,
92
+ & self . version. color( self . text_colors . info) ,
93
93
) ?;
94
94
}
95
95
@@ -98,7 +98,7 @@ impl std::fmt::Display for Info {
98
98
f,
99
99
"{}{}" ,
100
100
& self . get_formatted_subtitle_label( "Created" ) ,
101
- & self . creation_date. color( self . color_set . info) ,
101
+ & self . creation_date. color( self . text_colors . info) ,
102
102
) ?;
103
103
}
104
104
@@ -111,7 +111,7 @@ impl std::fmt::Display for Info {
111
111
f,
112
112
"{}{}" ,
113
113
& self . get_formatted_subtitle_label( title) ,
114
- languages_str. color( self . color_set . info)
114
+ languages_str. color( self . text_colors . info)
115
115
) ?;
116
116
}
117
117
@@ -120,7 +120,7 @@ impl std::fmt::Display for Info {
120
120
f,
121
121
"{}{}" ,
122
122
& self . get_formatted_subtitle_label( "Dependencies" ) ,
123
- & self . dependencies. color( self . color_set . info) ,
123
+ & self . dependencies. color( self . text_colors . info) ,
124
124
) ?;
125
125
}
126
126
@@ -133,7 +133,7 @@ impl std::fmt::Display for Info {
133
133
f,
134
134
"{}{}" ,
135
135
& self . get_formatted_subtitle_label( title) ,
136
- author_str. color( self . color_set . info) ,
136
+ author_str. color( self . text_colors . info) ,
137
137
) ?;
138
138
}
139
139
@@ -142,7 +142,7 @@ impl std::fmt::Display for Info {
142
142
f,
143
143
"{}{}" ,
144
144
& self . get_formatted_subtitle_label( "Last change" ) ,
145
- & self . last_change. color( self . color_set . info) ,
145
+ & self . last_change. color( self . text_colors . info) ,
146
146
) ?;
147
147
}
148
148
@@ -151,7 +151,7 @@ impl std::fmt::Display for Info {
151
151
f,
152
152
"{}{}" ,
153
153
& self . get_formatted_subtitle_label( "Repo" ) ,
154
- & self . repo_url. color( self . color_set . info) ,
154
+ & self . repo_url. color( self . text_colors . info) ,
155
155
) ?;
156
156
}
157
157
@@ -160,7 +160,7 @@ impl std::fmt::Display for Info {
160
160
f,
161
161
"{}{}" ,
162
162
& self . get_formatted_subtitle_label( "Commits" ) ,
163
- & self . commits. color( self . color_set . info) ,
163
+ & self . commits. color( self . text_colors . info) ,
164
164
) ?;
165
165
}
166
166
@@ -169,7 +169,7 @@ impl std::fmt::Display for Info {
169
169
f,
170
170
"{}{}" ,
171
171
& self . get_formatted_subtitle_label( "Lines of code" ) ,
172
- & self . lines_of_code. to_string( ) . color( self . color_set . info) ,
172
+ & self . lines_of_code. to_string( ) . color( self . text_colors . info) ,
173
173
) ?;
174
174
}
175
175
@@ -178,7 +178,7 @@ impl std::fmt::Display for Info {
178
178
f,
179
179
"{}{}" ,
180
180
& self . get_formatted_subtitle_label( "Size" ) ,
181
- & self . repo_size. color( self . color_set . info) ,
181
+ & self . repo_size. color( self . text_colors . info) ,
182
182
) ?;
183
183
}
184
184
@@ -187,7 +187,7 @@ impl std::fmt::Display for Info {
187
187
f,
188
188
"{}{}" ,
189
189
& self . get_formatted_subtitle_label( "License" ) ,
190
- & self . license. color( self . color_set . info) ,
190
+ & self . license. color( self . text_colors . info) ,
191
191
) ?;
192
192
}
193
193
@@ -233,13 +233,13 @@ impl Info {
233
233
let project_license = Detector :: new ( ) ?. get_project_license ( workdir_str) ;
234
234
let dominant_language = Language :: get_dominant_language ( & languages_stats) ;
235
235
let dependencies = deps:: DependencyDetector :: new ( ) . get_dependencies ( workdir_str) ?;
236
- let colors = Info :: get_colors (
236
+ let ascii_colors = Info :: get_ascii_colors (
237
237
& config. ascii_language ,
238
238
& dominant_language,
239
239
& config. ascii_colors ,
240
240
config. true_color ,
241
241
) ;
242
- let color_set = TextColor :: get_text_color_set ( & config. text_colors , & colors ) ;
242
+ let text_colors = TextColor :: get_text_colors ( & config. text_colors , & ascii_colors ) ;
243
243
244
244
Ok ( Info {
245
245
git_version : git_v,
@@ -261,8 +261,8 @@ impl Info {
261
261
number_of_tags,
262
262
number_of_branches,
263
263
license : project_license?,
264
- colors ,
265
- color_set ,
264
+ ascii_colors ,
265
+ text_colors ,
266
266
config,
267
267
} )
268
268
}
@@ -555,7 +555,7 @@ impl Info {
555
555
Ok ( output)
556
556
}
557
557
558
- fn get_colors (
558
+ fn get_ascii_colors (
559
559
ascii_language : & Language ,
560
560
dominant_language : & Language ,
561
561
ascii_colors : & [ String ] ,
@@ -608,8 +608,11 @@ impl Info {
608
608
}
609
609
610
610
fn get_formatted_subtitle_label ( & self , label : & str ) -> ColoredString {
611
- let formatted_label =
612
- format ! ( "{}{} " , label. color( self . color_set. subtitle) , ":" . color( self . color_set. colon) ) ;
611
+ let formatted_label = format ! (
612
+ "{}{} " ,
613
+ label. color( self . text_colors. subtitle) ,
614
+ ":" . color( self . text_colors. colon)
615
+ ) ;
613
616
self . bold ( & formatted_label)
614
617
}
615
618
@@ -632,19 +635,19 @@ impl Info {
632
635
if i == 0 {
633
636
author_field. push_str ( & format ! (
634
637
"{}{} {} {}\n " ,
635
- autor_contribution. to_string( ) . color( self . color_set . info) ,
636
- "%" . color( self . color_set . info) ,
637
- author_name. to_string( ) . color( self . color_set . info) ,
638
- author_nbr_commits. to_string( ) . color( self . color_set . info) ,
638
+ autor_contribution. to_string( ) . color( self . text_colors . info) ,
639
+ "%" . color( self . text_colors . info) ,
640
+ author_name. to_string( ) . color( self . text_colors . info) ,
641
+ author_nbr_commits. to_string( ) . color( self . text_colors . info) ,
639
642
) ) ;
640
643
} else {
641
644
author_field. push_str ( & format ! (
642
645
"{:<width$}{}{} {} {}\n " ,
643
646
"" ,
644
- autor_contribution. to_string( ) . color( self . color_set . info) ,
645
- "%" . color( self . color_set . info) ,
646
- author_name. to_string( ) . color( self . color_set . info) ,
647
- author_nbr_commits. to_string( ) . color( self . color_set . info) ,
647
+ autor_contribution. to_string( ) . color( self . text_colors . info) ,
648
+ "%" . color( self . text_colors . info) ,
649
+ author_name. to_string( ) . color( self . text_colors . info) ,
650
+ author_nbr_commits. to_string( ) . color( self . text_colors . info) ,
648
651
width = pad
649
652
) ) ;
650
653
}
@@ -671,19 +674,19 @@ impl Info {
671
674
} ;
672
675
673
676
for ( cnt, language) in languages. iter ( ) . enumerate ( ) {
674
- let formatted_number = format ! ( "{:.*}" , 1 , language. 1 ) . color ( self . color_set . info ) ;
677
+ let formatted_number = format ! ( "{:.*}" , 1 , language. 1 ) . color ( self . text_colors . info ) ;
675
678
if cnt != 0 && cnt % 2 == 0 {
676
679
language_field. push_str ( & format ! (
677
680
"\n {:<width$}{} ({} %) " ,
678
681
"" ,
679
- language. 0 . color( self . color_set . info) ,
682
+ language. 0 . color( self . text_colors . info) ,
680
683
formatted_number,
681
684
width = pad
682
685
) ) ;
683
686
} else {
684
687
language_field. push_str ( & format ! (
685
688
"{} ({} %) " ,
686
- language. 0 . color( self . color_set . info) ,
689
+ language. 0 . color( self . text_colors . info) ,
687
690
formatted_number
688
691
) ) ;
689
692
}
0 commit comments