Changing the particular color in an image
===

By using the following image i want to write code.

![enter image description here][1]


  [1]: http://i.stack.imgur.com/Us85Y.jpg


here is the image i want to do this one programmatically.
User can select roof or wall or fencing or windows. After selecting the particular part and color(another model) then the present color(another model) should replace with selected color.

In this image(example) user selected color(yellow) for wall and brown color for roof, after selection of color and part, old color should replace with new one.

How can we achieve this 
any suggestions or help 