To associate the attribute “Colors” to the product, do exactly as you would do for any other attribute belonging to WooCommerce types.
Add the new attribute and values in the section Attributes on the product page.
You can now configure the product settings through the created color attribute. There is an option to add a different (separated) image gallery for each of the product variations. In this case, each color will have its own image gallery.
The customers will see a different image gallery for every color they pick: