Changing background colors throughout and ONLINE study

URL of experiment: https://pavlovia.org/run/HarryKnitter/colorchange

Description of the problem:
I am trying to change the background color repeatedly during an online study. The actual aim is to create differently colored frames to signal to participants which task they need to perform in a given moment. I am therefure also planning to add a grey box in front of the background which does not cover the whole screen (thus resulting in a frame) .
Offline this works by adding a code component to the beginning of a routine stating win.setColor([x,x,x]). Online this does not work and it returns the error that win. is unknown. I guess in the online environment the background color needs to be set differently, however I cannot find a way to do it. Does anyone have an idea?

I attached the URL to a brief demo program which should simply change the background color, but returns the bespoken error.

All the best and thanks for reading up until here already,
Massimo

Hey,

Try psychoJS.window.color= new util.Color(thisCol)

Where thisCol is the color you want

Becca

ps. alternative workaround idea - present a large polygon larger than your background and render it first?

Hi Becca,

Thanks for the quick reply. I tried adding the code component. It indeed changes the background color, but unfortunately it only changes the color once I quite the fullscreen mode. Otherwise the background color remains unchanged.
However, I found a different solution with the polygons now. I added a polygone with a thick line width (e.g. 50) and its size specified as norm (2,2). This draws a nice frame around the screen and its color can be changed and updated by specifying the line color with a variable. :slight_smile:

Thanks a lot!