Ocean modifier color and foam
Final.



I've exaggerated a bit difference between deep and shallow water to present it better.

Node setup and overview.

Water.

Most important thing here is to separate generated texture coordinates on Z axis and assigned to it Color Ramp with our colors of choice representing deep and shallow water. You can add here more colors, not only two of them and/or change interpolation between color stops - I've used default (Linear).

Foam.  

First of all you will need to choose Foam Data Layer Name. I used... 'foam' and use it in Attribute node. I've also added a Math node with Power to fine tune mix between water and foam shader.

Mix.

You can now mix shaders by 'foam' factor and use any other shader for materials. I've used simple Glossy for water and Diffuse for foam.

Nodes and Ocean setup.