why do colors disappear with lighting?

I have an array of vertices, an array of colors, and an array of triangles. When I render these (DrawElements) with lighting disabled I see the colors but there is no shading (obviously). When I enable lighting (ambient and diffuse) I get shading, but all the vertex colors disappear; I only get the color of the light source. How can I get my separately colored objects (vertices) to show up with proper light source shading?

Never mind, I discovered that all I need to do is call glColorMaterial and enable COLOR_MATERIAL and it works.