M.L.
I'm a hairstylist. Many clients want to be looking good at the beach, so they usualy color their hair first (especially since people tend to take lots of photos!)
So, to protect color from the sun/ocean water, you can go ahead and color your hair now. Then, before you get in the beach water, spray your hair with clean water, mix in a little bit of conditioner in the water bottle or even use a store bought conditioning spray. Your hair will be full of the healthy water mix, so it will not absorb as much beach/pool water.
The floppy hat will help protect your hair from sun damage as well.
Also, I do recommend trimming after a color.