Well, those objects don't have a special prototype, so you can't add members to it. I think these are the alternatives:
1) Add the members to each instance (I know you don't like it, but it's an option). I'd go for this option
2) Just create a method, and pass each object as a parameter or as this
with fn.call()
3) Create a "class" with the added members, then create instances of it passing the original object in the constructor. Not ideal, but maybe you have to do it.
function Color(plainObj){
this.colorName: plainObj.colorName;
this.colorIsInRainbow: plainObj.colorIsInRainbow;
//if you want all properties to be copied dynamically, uncomment the following:
//for(var key in plainObj) this[key] = plainObj[key];
this.userClickedThisColor = ko.observable()
...
}
Color.prototype.colorStartsWithR = function() {
return this.colorName.charAt(0) == "R";
};
//etc
Then, to apply it
for(var i=0; i<colorData.length; i++){
colorData[i] = new Color(colorData[i]); //Overwrites original colorData array
}
Hope this helps. Cheers