This example shows how to define a color for each vertex of each polygon.

#VRML V2.0 utf8

Group {
   children [
      Shape {
         appearance
         Appearance {
            material
            Material {
               ambientIntensity 0.1
               diffuseColor     1 1 0
            }
         }

Here, we give the object some color and surface properties.  The object is
white and it is not reflecting any light.  The object is mildly lighted
(defined by ambientIntensity), even when there is no light defined in the
world.

         geometry
         IndexedFaceSet {
            coord
            Coordinate {
               point    [ 0 5 0,
                          -2.5 0 -2.5,
                          2.5 0 -2.5,
                          2.5 0 2.5,
                          -2.5 0 2.5 ]
            }

            color
            Color {
               color    [ 1 1 0,
                          0 1 1,
                          1 0 1,
                          1 0 0,
                          0 1 0,
                          0 0 1,
                          1 1 0,
                          0 1 1,
                          1 0 1,
                          1 0 0,
                          0 1 0,
                          0 0 1,
                          1 1 0,
                          0 1 1,
                          1 0 1,
                          1 0 0,
                          0 1 0,
                          0 0 1 ]
            }
            solid       FALSE
            creaseAngle 0.5
            coordIndex  [ 0, 4, 3, -1, 0, 3, 2, -1,
                          0, 2, 1, -1, 0, 1, 4, -1,
                          1, 3, 4, -1, 1, 2, 3, -1 ]
            colorIndex  [ 0, 1, 2, -1, 3, 4, 5, -1,
                          6, 7, 8, -1, 9, 10, 11, -1,
                          12, 13, 14, -1, 15, 16, 17, -1 ]
         }

IndexedFaceSet is a geometry node that can be used in geometry field
of a Shape node.  It defines a set of such faces to create an object of
arbitrary shape.  Usually one builds objects out of simple triangular
faces.  Its coord field holds the set of coordinates.  The point field
defines the vertices of the object.  There are five points defined here.
The points are labeled from 0 to 4.  Color field of node holds the color of
each point.  Color node creates a list of colors and may be used as the
color field of coordinate based geometry nodes (IndexedFaceSet, PointSet,
IndexedLineSet, ElevationGrid).  Solid field if TRUE indicates that Shape
encloses a volume and one can use so-called backface culling. CreaseAngle
field defines a crease angle threshold (in radians).  CoordIndex field
defines the path to connect the coordinates given in the coord field to
build a polyline.  Each value in the coordIndex is an integer index
specifying a coordinate from coord field.  Six polygons are defined here.
Each polygon is a triangle, so three points are named in the vertices list
and the -1 terminates the list.  Note, a polygon may have an arbitrary
number of vertices.  The colorIndex field defines the color of each point
(vertex) by matching the color with the corresponding coordinate (or
point).  The colorIndex must have -1's where coordIndex does and values of
colorIndex point to color array.

      }
     ]
}