diff --git a/color-types/src/lib.rs b/color-types/src/lib.rs index 98fe96722..21b5a1ac6 100644 --- a/color-types/src/lib.rs +++ b/color-types/src/lib.rs @@ -1,7 +1,7 @@ +use csscolorparser::Color; #[cfg(feature = "use_serde")] use serde::{Deserialize, Serialize}; use std::collections::HashMap; -use csscolorparser::Color; use std::hash::{Hash, Hasher}; use std::str::FromStr; @@ -239,7 +239,12 @@ impl From for (f32, f32, f32, f32) { impl From for SrgbaTuple { fn from(color: Color) -> Self { - Self(color.r as f32, color.g as f32, color.b as f32, color.a as f32) + Self( + color.r as f32, + color.g as f32, + color.b as f32, + color.a as f32, + ) } } @@ -359,17 +364,15 @@ impl SrgbaTuple { } pub fn to_laba(self) -> (f64, f64, f64, f64) { - Color::new(self.0.into(), self.1.into(), self.2.into(), self.3.into()) - .to_lab() + Color::new(self.0.into(), self.1.into(), self.2.into(), self.3.into()).to_lab() } pub fn to_hsla(self) -> (f64, f64, f64, f64) { - Color::new(self.0.into(), self.1.into(), self.2.into(), self.3.into()) - .to_hsla() + Color::new(self.0.into(), self.1.into(), self.2.into(), self.3.into()).to_hsla() } pub fn from_hsla(h: f64, s: f64, l: f64, a: f64) -> Self { - let Color{r, g, b, a} = Color::from_hsla(h, s, l, a); + let Color { r, g, b, a } = Color::from_hsla(h, s, l, a); Self(r as f32, g as f32, b as f32, a as f32) } diff --git a/lua-api-crates/color-funcs/src/image_colors.rs b/lua-api-crates/color-funcs/src/image_colors.rs index 1fefb4538..905f72c1c 100644 --- a/lua-api-crates/color-funcs/src/image_colors.rs +++ b/lua-api-crates/color-funcs/src/image_colors.rs @@ -288,7 +288,12 @@ pub fn extract_colors_from_image<'lua>( color.b.into(), 1.0, ); - let tuple = SrgbaTuple(color.r as f32, color.g as f32, color.b as f32, color.a as f32); + let tuple = SrgbaTuple( + color.r as f32, + color.g as f32, + color.b as f32, + color.a as f32, + ); ColorWrap(tuple.into()) }) .collect();