psychopy.org | Reference | Downloads | Github

Converting from RGB (-1:1) of the default setting in Psychopy to normal RGB (0:255)

OS (e.g. Win10): macOS Catalina version 10.15.2
PsychoPy version (e.g. 1.84.x): v1.90.3
Standard Standalone? (y/n)
What are you trying to achieve?:
I am using experimental settings. As everyone knows, the RGB setting in Psychopy is from -1:1. If I want to convert the RGB setting in Psychopy to normal RGB, how would I do that? For example, how much normal RGB is the ‘-0.5, -0.5, -0.5’ in Psychopy?
Thanks in advance.

You can directly use RGB255 without any need to convert it. Some of the components have this RGB255 so you can choose it. For those component that do not such a facility, you can use a code in the Begin Routine tab of the code chunk:

rgbColor = [100,100,100]

# Text
my_text.setColor(rgbColor, colorSpace='rgb255') 

# Line
my_line.setLineColor (rgbColor, colorSpace='rgb255')

# Shape
my_shape.setFillColor (rgbColor, colorSpace='rgb255') #fill color
my_shape.setLineColor (rgbColor, colorSpace='rgb255') # line color

Dear Omidrezza

I am sorry to be replying you the article so late. Your way is feasible. Thanks a lot.

Best regards

Chen