| Reference | Downloads | Github

Problem with colors in stimuli and polygon background

PsychoPy version (e.g. 1.84.x): v1.90.1 with Win 8

Hi !
I am building a 2-parts experiment with cyrillic alphabet as stimuli.
In the beginning of the experiment, I want to dispaly stimuli in grey color with a darker-grey background and in the second part it is red stimuli in a green background.
Colors RGB (Red Green Blue) for stimuli will be determined with pre-test.
Therefore, once we get them, I enter them in a connected Excel file with 4 columns (among others) :

  • Color for grey stimuli = CouleurMStim with [63, 63, 63]
  • Color for grey background = CouleurMBackground with [120, 120, 120]
  • Color for red stimuli = CouleurPStim with [152, 0, 0]
  • Color for green background = CouleurPBackground with [0, 140, 0]

But I have 2 problems :

  1. In order to facilitate color changes in background, I inserted a polygon (rectangle) in the routine and set it on top of the list for both parts of the experiment (see below)

In the polygon properties, I connected “fill color” to my Excel file with $CouleurMBackground or $CouleurPBackground depending on the part of the experiment and chose “set every repeat” for both.
When I run the esperiment, in the first part, background does not appear in grey but in white whereas in the second part, background effectively appears in green. Since, I’ve done the same for both parts, I don’t understand where do the mistake come from, do you ?

  1. The second problem is that for both parts of the experiment, text stimuli appear in red dotted with black (see below), whereas I want them to be either totally grey or totally red.
    In the text component of the routine, for “colour”, I refer to my excel file, and more precisely to “$CouleurMStim” or “$CouleurPStim” depending on the part of the experiment and chose “set every repeat” for both.

I checked for the loop connection with Excel file but it’s OK.

Could you please help me with this ?


Hi @JuliaV, can you try updating your polygon settings to use the rgb255 color space? The default rgb colorspace only takes values between -1 and 1 (e.g., ([-1, 0, 1]; see docs), whereas rgb255 takes values between 0 and 255, as you are using. The error with the text component occurs for similar reasons, although you cannot use the rgb255 color space with text components, so you will have to use the default rgb space and convert your values.

Thank you very much for your advices David ! Problems solved ! It is eventually working !