inkspot icon indicating copy to clipboard operation
inkspot copied to clipboard

hsv->rgb yields wrong result for white

Open martinzuern opened this issue 6 years ago • 1 comments

Color white is represented in HSV and HSL as [0 0 1] (as per https://en.wikipedia.org/wiki/HSL_and_HSV#Examples)

While rgb->hsv works perfectly fine, hsv->rgb (and hsl->rgb) return for white [1 1 1] instead of [255 255 255].

[1:0]~shadow.user=> (use 'inkspot.converter)
nil
[1:0]~shadow.user=> (rgb->hsv [255 255 255])
[0.0 0.0 1.0]
[1:0]~shadow.user=> (hsv->rgb [0 0 1])
#object[java.awt.Color 0x70c88923 "java.awt.Color[r=1,g=1,b=1]"]
[1:0]~shadow.user=> (hsv->rgb [0.0 0.0 1.0])
#object[java.awt.Color 0x15f63744 "java.awt.Color[r=1,g=1,b=1]"]
[1:0]~shadow.user=>

I think it's due to this line: https://github.com/rm-hull/inkspot/blob/ccb7a452a0930f451bcc6c960024d6029f616cd2/src/inkspot/converter.cljc#L29-L31

martinzuern avatar Apr 01 '19 20:04 martinzuern

Yes, I think you are correct.

rm-hull avatar Apr 01 '19 22:04 rm-hull