Create a new copy of selection with new colors

I am developing a plugin that will replace the colors of the selection. I have a display where the user can check how the new look is, then then they can generate with it.


  1. I will store the selection instance on a variable
  2. I will use that variable to swap the new colors, and then I will view it as a preview.
  3. Then if a user is satisfied, they can generate a fresh replica of it, with new colors.

Can I get a little help on coding this?