How is color assigned to each vertex inside triangle?

	GLfloat vVertices[] = {
		0.0f, 0.5f, 0.0f, 
		-0.5f, -0.5f, 0.0f,
		0.5f, -0.5f,  0.0f,
		
		1.0f, 0.0f, 0.0f, 
		0.0f, 1.0f, 0.0f,
		0.0f, 0.0f, 1.0f
	};

Here, first three vectors are for three vertices for triangle. Last three vectors are used for colors. I get a RGB triangle like this:


My question is: how is color assigned to each vertex inside triangle? I did not set color for all the vertices of this triangle. I think, the last three vectors are colors for three vertices of corner of the triangle.

However your GL code sets up the vertex attributes (you didn’t include any of this in your post).

I think you’re confusing pixels (fragments) and vertices. A triangle only has three vertices, whose all colors you did set. As for fragments, yes, in OpenGL you can choose from a few ways of interpolating the values. Refer to:
https://www.khronos.org/opengl/wiki/Type_Qualifier_(GLSL)#Interpolation_qualifiers
Also: