Skip to content

Commit

Permalink
add with_alpha method for Color to easily transform alpha in colors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatino authored and not-fl3 committed Jan 30, 2025
1 parent 5d9cf06 commit b6f43bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ impl Color {
pub const fn from_vec(vec: glam::Vec4) -> Self {
Self::new(vec.x, vec.y, vec.z, vec.w)
}

pub const fn with_alpha(&self, alpha: f32) -> Color {
Color::new(self.r, self.g, self.b, alpha)
}
}

pub mod colors {
Expand Down

0 comments on commit b6f43bb

Please sign in to comment.