import std.math : isClose; with(RGB888(0, 0, 0).toHSV) { assert(hue == 0); assert(saturation == 0); assert(value == 0); } with(RGB888(0, 128, 192).toHSV) { assert(hue.isClose(0.5555555555)); assert(saturation.isClose(1.0)); assert(value.isClose(0.7529411765)); } with(RGB888(255, 255, 0).toHSV) { assert(hue.isClose(0.1666666667)); assert(saturation.isClose(1.0)); assert(value.isClose(1.0)); } with(RGB888(255, 0, 0).toHSV) { assert(hue.isClose(0.0)); assert(saturation.isClose(1.0)); assert(value.isClose(1.0)); } with(RGB888(255, 0, 255).toHSV) { assert(hue.isClose(0.8333333333)); assert(saturation.isClose(1.0)); assert(value.isClose(1.0)); } with(RGB888(0, 255, 0).toHSV) { assert(hue.isClose(0.3333333333)); assert(saturation.isClose(1.0)); assert(value.isClose(1.0)); } with(RGB888(0, 0, 255).toHSV) { assert(hue.isClose(0.6666666667)); assert(saturation.isClose(1.0)); assert(value.isClose(1.0)); }