1
1
use crate :: cli:: { self , Config } ;
2
2
use crate :: ui:: get_ascii_colors;
3
- use crate :: ui:: text_color:: TextColor ;
3
+ use crate :: ui:: { text_color:: TextColor , ColorizeOption } ;
4
4
use anyhow:: Result ;
5
5
use author:: Author ;
6
6
use colored:: { Color , ColoredString , Colorize } ;
@@ -56,7 +56,7 @@ impl std::fmt::Display for Info {
56
56
let ( git_info_field_str, git_info_field_len) = self . get_git_info_field ( ) ;
57
57
writeln ! ( f, "{}" , git_info_field_str) ?;
58
58
let separator = "-" . repeat ( git_info_field_len) ;
59
- writeln ! ( f, "{}" , separator. color ( self . text_colors. underline) ) ?;
59
+ writeln ! ( f, "{}" , separator. try_color ( self . text_colors. underline) ) ?;
60
60
}
61
61
62
62
if !self . config . disabled_fields . project && !self . repo_name . is_empty ( ) {
@@ -225,7 +225,7 @@ impl Info {
225
225
info : & str ,
226
226
f : & mut std:: fmt:: Formatter ,
227
227
) -> std:: fmt:: Result {
228
- let info_colored = info. color ( self . text_colors . info ) ;
228
+ let info_colored = info. try_color ( self . text_colors . info ) ;
229
229
writeln ! (
230
230
f,
231
231
"{} {}" ,
@@ -247,7 +247,7 @@ impl Info {
247
247
let formatted_label = format ! (
248
248
"{}{}" ,
249
249
label. color( self . text_colors. subtitle) ,
250
- ":" . color ( self . text_colors. colon)
250
+ ":" . try_color ( self . text_colors. colon)
251
251
) ;
252
252
self . bold ( & formatted_label)
253
253
}
@@ -268,7 +268,7 @@ impl Info {
268
268
format ! (
269
269
"{} {} {}" ,
270
270
& self . bold( & self . git_username) . color( self . text_colors. title) ,
271
- & self . bold( "~" ) . color ( self . text_colors. tilde) ,
271
+ & self . bold( "~" ) . try_color ( self . text_colors. tilde) ,
272
272
& self . bold( & self . git_version) . color( self . text_colors. title)
273
273
) ,
274
274
git_info_length + 3 ,
@@ -291,7 +291,7 @@ impl Info {
291
291
let pad = title. len ( ) + 2 ;
292
292
293
293
for ( i, author) in self . authors . iter ( ) . enumerate ( ) {
294
- let author_str = format ! ( "{}" , author) . color ( self . text_colors . info ) ;
294
+ let author_str = format ! ( "{}" , author) . try_color ( self . text_colors . info ) ;
295
295
296
296
if i == 0 {
297
297
author_field. push_str ( & format ! ( "{}" , author_str) ) ;
@@ -351,7 +351,7 @@ impl Info {
351
351
for ( i, language) in languages. iter ( ) . enumerate ( ) {
352
352
let formatted_number = format ! ( "{:.*}" , 1 , language. 1 ) ;
353
353
let language_with_perc =
354
- format ! ( "{} ({} %)" , language. 0 , formatted_number) . color ( self . text_colors . info ) ;
354
+ format ! ( "{} ({} %)" , language. 0 , formatted_number) . try_color ( self . text_colors . info ) ;
355
355
let language_chip = "\u{25CF} " . color ( language. 2 ) ;
356
356
let language_str = format ! ( "{} {} " , language_chip, language_with_perc) ;
357
357
if i % 2 == 0 {
0 commit comments