Assigning colors for colorblind participants

Hi everyone,
I am creating an experiment where I will show participants 6 different colored squares and in the test trial only one square should change color and participants will choose the square they think that changed color. For that I will use safe colors for colorblind participants. (PsychoPy Colours - Google Sheets) However, when trying to assign these colors I am getting this error:

and I defined the colors in the code like this:


thanks so much for the help!

I’m not sure about this error, but I have some ideas:
First, here is the relevant help page, which you’ve probably already seen.
https://www.psychopy.org/general/colours.html

Since the error indicates that Psychopy knows you are trying to define a color, I am guessing you are using some command like stim.setColor() later in your code. I am guessing this is what is generating the error, rather than the page pictured above. In the above code, you are just defining blue_bright as a sequence of numbers, but it’s not identified as a color.

Now, if you look at some of the examples from the help page, you see some possible ways of defining a color. I’ll focus on these two:

stim.setColor('Firebrick') #one of the web/X11 color names
stim.setColor([1,1,1], colorSpace='rgb') #all guns to max

It seems to me that you are trying to create custom colors and then reference them later. However, to do that you would need to use the variable blue_bright (which will just stick your three custom numbers into the first argument) and not the text 'blue_bright' which would try to find a web/X11 color called ‘blue_bright’.

Maybe I’m way off base, but in any case it will be helpful to check how the variable is being called later and post this info for further troubleshooting.

1 Like

hi! thanks a lot for your suggestion! I have used setfill.color actually as this is an online experiment and thats how it was suggested on the crib sheet : PsychoPy Python to Javascript crib sheet 2023 - Google Docs

do you think there is something else I can try? thank you again!!

I think it would be helpful to see exactly how you called setfill.color() to understand what’s going on.