Hi!
Is it possible to change a single label color of slider (e.g. 1 in blue, 6 in red) directly in JS (online script)?
Best regards,
Thomas
Hi!
Is it possible to change a single label color of slider (e.g. 1 in blue, 6 in red) directly in JS (online script)?
Best regards,
Thomas
In PsychoPy you can do that like this:
mySlider.labels[0].color = 'red' # label on the left
mySlider.labels[-1].color = 'blue' # label on the right
and the PsychoJS lib does a pretty good job of mimicking the Python equivalent, so I think that would be worth a try (actually, I donât know if negative indexing works in JS so you might need to count up instead)
Hi,
unfortunately it doesnât work in any variation I tried - I get message: TypeError: Cannot create property âcolorâ on string or experiment simply doesnât start.
Hi @tomm, just needs a slight amendment. Try:
mySlider.labelObjs[0].color = 'red' # etc
The following line is working perfectly in python, however I am not sure what should be its equivalent in javascript.
mySlider.labelObjs[0].color = 'red'
I am using the type âsliderâ for the slider component but when assigning the color of the the bar it also changes the color of the labels. I would like the bar in the LightGrey and the labels in Black but I havenât been able to do that so far in javascript.