# How to vary color of a graphics primitive?

I would like to be able to vary color of a graphics primitive. For starters, varying color of a Line object along it's length would be sufficient. For example, if I have a ColorDataFunction function f, the first point of the the line, the color would be f[0] and the last point f[1]. Or something similar. The only idea I got was to take ColorData[myScheme, "Image"] and transform it as needed or somehow exploit a ParametricPlot. But this both seems really clumsy. Is there a better way? Essentially, I would like something equivalent to adding a ColorFunction-like parameter to Graphics.

• What about 31131 – Kuba Jan 5 '18 at 21:58
• It seems that at least for Line, the VertexColors parameter does what I need. – user1747134 Jan 5 '18 at 22:06