Colorize mesh according to the nodepoint colors

Given a set p of points (2D), each with a unique color c, I can mesh these points easily

p = RandomReal[{0, 1}, {10, 2}];
c = Map[Hue[#] &, RandomReal[{0, 1}, 10]];
Show[DelaunayMesh[p],Graphics[Graphics[MapThread[{PointSize[.05], #1, Point[#2]} &, {c, p}]]]]


My question:

How can I easily colorize the lines and/or triangles according to the neighboring node colors?

Thanks!

• Can you clarify the rules? For instance, what color should the line between a blue and yellow dot be? How should a triangle face color be chosen, given the colors of its vertices? – MarcoB Mar 6 '19 at 18:52
• @ MarcoB Along the line I would expect some blending. – Ulrich Neumann Mar 6 '19 at 18:55

Do you mean something like this?

R = DelaunayMesh[p];
Graphics[
GraphicsComplex[
MeshCoordinates[R],
MeshCells[R, 2, "Multicells" -> True],
VertexColors -> c
]
]


Edit

Getting colorgradients on the edges only seems to be somewhat trickier as VertexCoordinate for Line objects in a GraphicsComplex does not work. A workaround could be this:

elist = Flatten[MeshCells[R, 1, "Multicells" -> True][[1, 1]]];
Graphics[
Line[
Partition[MeshCoordinates[R][[elist]], 2],
VertexColors -> Partition[c[[elist]], 2]
]
]


• Yes, that's it! Thank you very much – Ulrich Neumann Mar 6 '19 at 18:58
• You're welcome, Ulrich. – Henrik Schumacher Mar 6 '19 at 19:02
• @ Henrik Where can I find information about the option "Multicells" -> True? In MMA v11.0.1. it isn't known . – Ulrich Neumann Mar 6 '19 at 19:28
• Nowhere. user21 once told me. Very useful. Even the syntax highlighter of version 11.3 but it might work in version 11.0.1 already. If not, you may use Polygon[MeshCells[R, 2][[All, 1]]] instead (but it unpacks arrays and therefore may be slower for large meshes). – Henrik Schumacher Mar 6 '19 at 19:35
• Again thank you for your useful help! – Ulrich Neumann Mar 6 '19 at 19:39