diff --git a/src/color.rs b/src/color.rs index 6793ea3..07af604 100644 --- a/src/color.rs +++ b/src/color.rs @@ -223,6 +223,20 @@ impl Color { a: NV_ONE, }; + /// Creates a new color from 4 components. + /// + /// # Safety + /// + /// All values must be in 0..=1 range. + pub const unsafe fn from_rgba_unchecked(r: f32, g: f32, b: f32, a: f32) -> Self { + Color { + r: NormalizedF32::new_unchecked(r), + g: NormalizedF32::new_unchecked(g), + b: NormalizedF32::new_unchecked(b), + a: NormalizedF32::new_unchecked(a), + } + } + /// Creates a new color from 4 components. /// /// All values must be in 0..=1 range.