@@ -5,7 +5,7 @@ use ansi_term::{ANSIGenericString, Prefix, Style, Suffix};
5
5
use atty:: Stream ;
6
6
7
7
#[ derive( Copy , Clone ) ]
8
- pub struct Color {
8
+ pub ( crate ) struct Color {
9
9
use_color : UseColor ,
10
10
atty : bool ,
11
11
style : Style ,
@@ -31,96 +31,96 @@ impl Color {
31
31
}
32
32
}
33
33
34
- pub fn fmt ( fmt : & Formatter ) -> Color {
34
+ pub ( crate ) fn fmt ( fmt : & Formatter ) -> Color {
35
35
if fmt. alternate ( ) {
36
36
Color :: always ( )
37
37
} else {
38
38
Color :: never ( )
39
39
}
40
40
}
41
41
42
- pub fn auto ( ) -> Color {
42
+ pub ( crate ) fn auto ( ) -> Color {
43
43
Color {
44
44
use_color : UseColor :: Auto ,
45
45
..default ( )
46
46
}
47
47
}
48
48
49
- pub fn always ( ) -> Color {
49
+ pub ( crate ) fn always ( ) -> Color {
50
50
Color {
51
51
use_color : UseColor :: Always ,
52
52
..default ( )
53
53
}
54
54
}
55
55
56
- pub fn never ( ) -> Color {
56
+ pub ( crate ) fn never ( ) -> Color {
57
57
Color {
58
58
use_color : UseColor :: Never ,
59
59
..default ( )
60
60
}
61
61
}
62
62
63
- pub fn stderr ( self ) -> Color {
63
+ pub ( crate ) fn stderr ( self ) -> Color {
64
64
self . redirect ( Stream :: Stderr )
65
65
}
66
66
67
- pub fn stdout ( self ) -> Color {
67
+ pub ( crate ) fn stdout ( self ) -> Color {
68
68
self . redirect ( Stream :: Stdout )
69
69
}
70
70
71
- pub fn doc ( self ) -> Color {
71
+ pub ( crate ) fn doc ( self ) -> Color {
72
72
self . restyle ( Style :: new ( ) . fg ( Blue ) )
73
73
}
74
74
75
- pub fn error ( self ) -> Color {
75
+ pub ( crate ) fn error ( self ) -> Color {
76
76
self . restyle ( Style :: new ( ) . fg ( Red ) . bold ( ) )
77
77
}
78
78
79
- pub fn warning ( self ) -> Color {
79
+ pub ( crate ) fn warning ( self ) -> Color {
80
80
self . restyle ( Style :: new ( ) . fg ( Yellow ) . bold ( ) )
81
81
}
82
82
83
- pub fn banner ( self ) -> Color {
83
+ pub ( crate ) fn banner ( self ) -> Color {
84
84
self . restyle ( Style :: new ( ) . fg ( Cyan ) . bold ( ) )
85
85
}
86
86
87
- pub fn command ( self ) -> Color {
87
+ pub ( crate ) fn command ( self ) -> Color {
88
88
self . restyle ( Style :: new ( ) . bold ( ) )
89
89
}
90
90
91
- pub fn parameter ( self ) -> Color {
91
+ pub ( crate ) fn parameter ( self ) -> Color {
92
92
self . restyle ( Style :: new ( ) . fg ( Cyan ) )
93
93
}
94
94
95
- pub fn message ( self ) -> Color {
95
+ pub ( crate ) fn message ( self ) -> Color {
96
96
self . restyle ( Style :: new ( ) . bold ( ) )
97
97
}
98
98
99
- pub fn annotation ( self ) -> Color {
99
+ pub ( crate ) fn annotation ( self ) -> Color {
100
100
self . restyle ( Style :: new ( ) . fg ( Purple ) )
101
101
}
102
102
103
- pub fn string ( self ) -> Color {
103
+ pub ( crate ) fn string ( self ) -> Color {
104
104
self . restyle ( Style :: new ( ) . fg ( Green ) )
105
105
}
106
106
107
- pub fn active ( & self ) -> bool {
107
+ pub ( crate ) fn active ( & self ) -> bool {
108
108
match self . use_color {
109
109
UseColor :: Always => true ,
110
110
UseColor :: Never => false ,
111
111
UseColor :: Auto => self . atty ,
112
112
}
113
113
}
114
114
115
- pub fn paint < ' a > ( & self , text : & ' a str ) -> ANSIGenericString < ' a , str > {
115
+ pub ( crate ) fn paint < ' a > ( & self , text : & ' a str ) -> ANSIGenericString < ' a , str > {
116
116
self . effective_style ( ) . paint ( text)
117
117
}
118
118
119
- pub fn prefix ( & self ) -> Prefix {
119
+ pub ( crate ) fn prefix ( & self ) -> Prefix {
120
120
self . effective_style ( ) . prefix ( )
121
121
}
122
122
123
- pub fn suffix ( & self ) -> Suffix {
123
+ pub ( crate ) fn suffix ( & self ) -> Suffix {
124
124
self . effective_style ( ) . suffix ( )
125
125
}
126
126
}
0 commit comments