Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color with invalid _rgb array? #495

Open
nils-wisiol opened this issue May 11, 2022 · 0 comments
Open

Color with invalid _rgb array? #495

nils-wisiol opened this issue May 11, 2022 · 0 comments

Comments

@nils-wisiol
Copy link

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 _rgb is 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant