Started palette editor.
Test and Build / test-and-build (push) Failing after 1m47s

Cleaned up tests and lint errors.
Upgraded npm packages.
This commit is contained in:
Jay
2026-03-19 18:54:44 -04:00
parent 6be2d9e41a
commit 9fec89949b
36 changed files with 1484 additions and 1229 deletions
+16 -2
View File
@@ -167,6 +167,21 @@ impl Color {
Component::HCL_L => Color::from_hcl(self.hcl.h, self.hcl.c, value),
}
}
/// Checks if two Color objects are equal
///
/// # Example:
///
/// ```
/// use colorlib::Color;
///
/// let color1 = Color::from_hex("FF0000");
/// let color2 = Color::from_hex("FF0000");
/// assert!(color1.equals(&color2));
/// ```
pub fn equals(&self, other: &Color) -> bool {
self == other
}
}
#[cfg(test)]
@@ -252,8 +267,7 @@ mod tests {
fn color_from_hcl() {
let hex_code = "4B964B";
let (hr, hg, hb) = (75u8, 150u8, 75u8);
let (r, g, b) =
(75.19744022437494, 150.3948804487499, 75.19744022437494);
let (r, g, b) = (75.19744022437494, 150.3948804487499, 75.19744022437494);
let (h1, s, v) = (120.0, 0.5, 0.5897838448970584);
let (h2, c, l) = (120.0, 0.5, 0.49);
+16 -9
View File
@@ -85,6 +85,21 @@ impl HCL {
let c = calc::chroma(h, s, l);
HCL::new(h, c, l)
}
/// Checks if two HCL colors are equal
///
/// # Example:
///
/// ```
/// use colorlib::hcl::HCL;
///
/// let hcl1 = HCL::new(0.0, 1.0, 0.55);
/// let hcl2 = HCL::new(0.0, 1.0, 0.55);
/// assert!(hcl1.equals(&hcl2));
/// ```
pub fn equals(&self, other: &HCL) -> bool {
self == other
}
}
#[cfg(test)]
@@ -185,15 +200,7 @@ mod tests {
0.864996,
0.521301
);
from_hsv!(
from_hsv_dark_magenta,
300.0,
0.9,
0.5,
300.0,
0.9,
0.323601
);
from_hsv!(from_hsv_dark_magenta, 300.0, 0.9, 0.5, 300.0, 0.9, 0.323601);
from_hsv!(
from_hsv_light_magenta,
300.0,
+15
View File
@@ -138,6 +138,21 @@ impl Hex {
b: decoded[2],
}
}
/// Checks if two Hex colors are equal
///
/// # Example:
///
/// ```
/// use colorlib::hex::Hex;
///
/// let hex1 = Hex::from_code("FF0000");
/// let hex2 = Hex::from_code("FF0000");
/// assert!(hex1.equals(&hex2));
/// ```
pub fn equals(&self, other: &Hex) -> bool {
self == other
}
}
#[cfg(test)]
+15
View File
@@ -114,6 +114,21 @@ impl HSV {
let v = calc::value(h, s, l);
HSV::new(h, s, v)
}
/// Checks if two HSV colors are equal
///
/// # Example:
///
/// ```
/// use colorlib::hsv::HSV;
///
/// let hsv1 = HSV::new(0.0, 1.0, 1.0);
/// let hsv2 = HSV::new(0.0, 1.0, 1.0);
/// assert!(hsv1.equals(&hsv2));
/// ```
pub fn equals(&self, other: &HSV) -> bool {
self == other
}
}
#[cfg(test)]
+15
View File
@@ -93,6 +93,21 @@ impl RGB {
let hsv = HSV::from_hcl(h, c, l);
RGB::from_hsv(hsv.h, hsv.s, hsv.v)
}
/// Checks if two RGB colors are equal
///
/// # Example:
///
/// ```
/// use colorlib::rgb::RGB;
///
/// let rgb1 = RGB::new(255.0, 0.0, 0.0);
/// let rgb2 = RGB::new(255.0, 0.0, 0.0);
/// assert!(rgb1.equals(&rgb2));
/// ```
pub fn equals(&self, other: &RGB) -> bool {
self == other
}
}
#[cfg(test)]