Not sure what your question about, but try this.
function get_color(e) {
//var data = e.parameter.nameLabel
var data = red;
if (data == red){
//...
} else {
//...
}
}
so you can use the debugger to test your scripts without considering events
I hope it helps you!