The shorter wavelengths of light, such as blue and violet light, are scattered more easily by water molecules than the longer wavelengths of light, such as red and orange light. This is because the shorter wavelengths of light have a higher energy than the longer wavelengths of light. When sunlight hits the ocean, the blue and violet light is scattered in all directions, while the red and orange light is absorbed by the water molecules. This is why the ocean appears blue.
In addition to water molecules, the presence of particles in the water can also affect the color of the ocean. For example, the presence of phytoplankton, which are microscopic plants, can give the ocean a greenish color. The presence of sediment, such as sand and mud, can give the ocean a brownish color.
The color of the ocean can also vary depending on the time of day and the location. For example, the ocean may appear darker blue in the early morning and evening, and it may appear lighter blue in the afternoon. The ocean may also appear different colors in different parts of the world, due to variations in the amount of phytoplankton, sediment, and other particles in the water.