psychojs
psychojs copied to clipboard
Color with invalid _rgb array?
When calling the Color constructor with this argument, a seemingly invalid _rgb array is produced:
>> (new util.Color((1.0000, 1, -1.0000)))._rgb
<< Array(3) [ 257, 1, 1 ]
When using this color in getContrastedColor, an error will be thrown. The resulting error message will be "all color components should be in [-1,1]".
Two suggestions:
- Make sure
_rgbis always filled correctly. - Include offending color value in error message to ease debugging.
Tested with Psychojs 2022.1.2 in Firefox.
Thanks for maintaining psychojs! :-)
@Jennybaga