diff --git a/README.md b/README.md index 620758d..559bcd6 100644 --- a/README.md +++ b/README.md @@ -189,8 +189,8 @@ color.saturation(); // 0.68 color.lightness(); // 0.8039 color.hsv_hue(); // 210.0 -color.hsv_saturation(); // 0.28 -color.hsv_value(); // 0.94 +color.hsv_saturation(); // 0.2845 +color.hsv_value(); // 0.9373 color.luma(); // 0.59 color.luminance(); // 0.79 diff --git a/src/conversion/hsv.rs b/src/conversion/hsv.rs index f39a1e3..7a4ab14 100644 --- a/src/conversion/hsv.rs +++ b/src/conversion/hsv.rs @@ -50,7 +50,7 @@ pub fn rgb2hsv(color: (f64, f64, f64)) -> (f64, f64, f64) { s = delta / max; } - (round(h, 2), round(s, 2), round(v, 2)) + (round(h, 4), round(s, 4), round(v, 4)) } #[cfg(test)] diff --git a/tests/color_channel.rs b/tests/color_channel.rs index a5dce75..63074d4 100644 --- a/tests/color_channel.rs +++ b/tests/color_channel.rs @@ -15,8 +15,8 @@ fn test_color_channel() { assert_eq!(color.lightness(), 0.8039); assert_eq!(color.hsv_hue(), 210.0); - assert_eq!(color.hsv_saturation(), 0.28); - assert_eq!(color.hsv_value(), 0.94); + assert_eq!(color.hsv_saturation(), 0.2845); + assert_eq!(color.hsv_value(), 0.9373); assert_eq!(color.luma(), 0.59); assert_eq!(color.luminance(), 0.79);