Electrons have the tendency to vibrate at their own natural frequency. When a light wave with the exact same frequency as the electron hits it, the interaction causes the electron to begin moving (while continuing to vibrate). To do this, the electron absorbs the energy of the light wave which starts the vibrational motion. Reflection and transmission of light waves occur when the wave frequencies do not match the electron’s vibrational frequency. The electron picks up the frequency of the light wave and begins to vibrate much smaller and shorter than the light wave did. Ultimately, the energy is re-emitted as a light wave. Light waves are transmitted when the object is transparent and reflected when the object is opaque.
Color is a result of the way light hits an object. It’s not actually there without light. Whatever color an object does not absorb out of ROYGBIV, is the color we see with our eyes.