| Reference | Downloads | Github

RGB 255 Color Space

Hello all,

In my experiment, I aim to manipulate the brightness of some sentences using RGB255 color space. I wrote the following code:

# In the begin routine:
rg = []

if Brightness == "High":
    rnd = np.random.normal(30, 1)
    rndInt = int (rnd)
    rg.append ("{},{},{}".format (rndInt ,rndInt ,rndInt ))

elif Brightness == "Low":
    rnd = np.random.normal(40, 1)
    rndInt = int (rnd)
    rg.append ("{},{},{}".format (rndInt ,rndInt ,rndInt ))

vocabs.setColor(rg, colorSpace='rgb255')

# In the end routine:

thisExp.addData ("RGB", rg)

However, I face with an error regarding the float number. Is the way that I append the random number to the list is problematic?

The code as above will only produce values of [30, 30, 30] or [40, 40, 40]. Presumably you are doing something along the way between the start of the routine and the end of the routine to manipulate the value of rg, as otherwise you would just save it immediately along with the code used to create it, in the “begin routine” tab?

1 Like

Hi Michael,

Yes you are right. I made a foolish mistake. Those values are there in condition file. I solved the problem and I edited my post.
Thank you