PennController for IBEX › Forums › Support › randomizing the color of the text? › Reply To: randomizing the color of the text?
October 27, 2020 at 11:40 am
#6261
Jeremy
Keymaster
Hi,
If you are fine with total randomization, you can do something like this:
newTrial( newButton(['blue','red','green','purple'][Math.floor(Math.random()*4)]) .css("color", ['blue','red','green','purple'][Math.floor(Math.random()*4)]) .print() .wait() )
Another option is to use pseudo-randomization by listing pre-generated color associations in a table and simply refer to the columns from inside Template
Jeremy