1
1
use crate :: Component ;
2
2
3
3
#[ doc( hidden) ]
4
- pub use palette_derive:: Transparency ;
4
+ pub use palette_derive:: WithAlpha ;
5
5
6
6
pub use self :: alpha:: * ;
7
7
8
8
mod alpha;
9
9
10
10
/// A trait for color types that can have or be given transparency (alpha channel).
11
11
///
12
- /// `Transparency ` is an interface for adding, removing and setting the alpha
12
+ /// `WithAlpha ` is an interface for adding, removing and setting the alpha
13
13
/// channel of a color type. The color type itself doesn't need to store the
14
14
/// transparency value as it can be transformed into or wrapped in a type that
15
15
/// has a representation of transparency. This would typically be done by
@@ -23,9 +23,9 @@ mod alpha;
23
23
/// Derived without an internal alpha channel:
24
24
///
25
25
/// ```
26
- /// use palette::Transparency ;
26
+ /// use palette::WithAlpha ;
27
27
///
28
- /// #[derive(Transparency )]
28
+ /// #[derive(WithAlpha )]
29
29
/// struct CustomColor {
30
30
/// redness: f32,
31
31
/// glow: f32,
@@ -45,9 +45,9 @@ mod alpha;
45
45
/// Derived with an internal alpha channel:
46
46
///
47
47
/// ```
48
- /// use palette::Transparency ;
48
+ /// use palette::WithAlpha ;
49
49
///
50
- /// #[derive(Transparency )]
50
+ /// #[derive(WithAlpha )]
51
51
/// struct CustomColor {
52
52
/// redness: f32,
53
53
/// glow: f32,
@@ -67,7 +67,7 @@ mod alpha;
67
67
///
68
68
/// assert_eq!(transparent.alpha, 10);
69
69
/// ```
70
- pub trait Transparency < A : Component > : Sized {
70
+ pub trait WithAlpha < A : Component > : Sized {
71
71
/// The opaque color type, without any transparency.
72
72
///
73
73
/// This is typically `Self`.
@@ -76,14 +76,14 @@ pub trait Transparency<A: Component>: Sized {
76
76
/// The color type with transparency applied.
77
77
///
78
78
/// This is typically `Alpha<Self::Color, A>`.
79
- type WithAlpha : Transparency < A , Color = Self :: Color , WithAlpha = Self :: WithAlpha > ;
79
+ type WithAlpha : WithAlpha < A , Color = Self :: Color , WithAlpha = Self :: WithAlpha > ;
80
80
81
81
/// Transforms the color into a transparent color with the provided
82
82
/// alpha value. If `Self` already has a transparency, it is
83
83
/// overwritten.
84
84
///
85
85
/// ```
86
- /// use palette::{Srgb, Transparency };
86
+ /// use palette::{Srgb, WithAlpha };
87
87
///
88
88
/// let color = Srgb::new(255u8, 0, 255);
89
89
///
@@ -102,7 +102,7 @@ pub trait Transparency<A: Component>: Sized {
102
102
/// `A::max_intensity()` to make it opaque.
103
103
///
104
104
/// ```
105
- /// use palette::{Srgba, Srgb, Transparency };
105
+ /// use palette::{Srgba, Srgb, WithAlpha };
106
106
///
107
107
/// let transparent = Srgba::new(255u8, 0, 255, 10);
108
108
///
@@ -120,7 +120,7 @@ pub trait Transparency<A: Component>: Sized {
120
120
/// `A::max_intensity()` to make it opaque.
121
121
///
122
122
/// ```
123
- /// use palette::{Srgba, Srgb, Transparency };
123
+ /// use palette::{Srgba, Srgb, WithAlpha };
124
124
///
125
125
/// let transparent = Srgba::new(255u8, 0, 255, 10);
126
126
///
@@ -135,7 +135,7 @@ pub trait Transparency<A: Component>: Sized {
135
135
/// field. If `Self` already has a transparency, it is overwritten.
136
136
///
137
137
/// ```
138
- /// use palette::{Srgb, Srgba, Transparency };
138
+ /// use palette::{Srgb, Srgba, WithAlpha };
139
139
///
140
140
/// let color = Srgb::new(255u8, 0, 255);
141
141
///
@@ -150,7 +150,7 @@ pub trait Transparency<A: Component>: Sized {
150
150
/// already has a transparency, it is overwritten.
151
151
///
152
152
/// ```
153
- /// use palette::{Srgb, Srgba, Transparency };
153
+ /// use palette::{Srgb, Srgba, WithAlpha };
154
154
///
155
155
/// let color = Srgb::new(255u8, 0, 255);
156
156
///
0 commit comments