use crate::{alpha::AlphaLast, rgb::Rgbf32};
pub type Rgbaf32 = AlphaLast<f32, Rgbf32>;
impl Rgbaf32 {
#[must_use]
pub const fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self {
Self::with_color(a, Rgbf32::from_rgb(r, g, b))
}
}
#[cfg(test)]
#[allow(clippy::float_cmp)]
mod tests {
use super::*;
use crate::{rgb::HasBlue, rgb::HasGreen, rgb::HasRed};
#[test]
fn test_new() {
let color = Rgbaf32::from_rgba(1.0, 0.0, 0.0, 1.0);
assert_eq!(color.red(), 1.0);
assert_eq!(color.green(), 0.0);
assert_eq!(color.blue(), 0.0);
assert_eq!(color.alpha(), 1.0);
}
}