Skip to content

Commit b6f43bb

Browse files
jonatinonot-fl3
authored andcommitted
add with_alpha method for Color to easily transform alpha in colors
1 parent 5d9cf06 commit b6f43bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/color.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ impl Color {
140140
pub const fn from_vec(vec: glam::Vec4) -> Self {
141141
Self::new(vec.x, vec.y, vec.z, vec.w)
142142
}
143+
144+
pub const fn with_alpha(&self, alpha: f32) -> Color {
145+
Color::new(self.r, self.g, self.b, alpha)
146+
}
143147
}
144148

145149
pub mod colors {

0 commit comments

Comments
 (0)