Here’s a basic example of coloring mesh vertices by their Z value using Grasshopper:
220521_ColorMeshVerticesByZ_00.gh (310.0 KB)
You can open the file directly with Rhino or drag-and-drop it.
If you’re looking to color the mesh faces instead, you can do something like this (using Python):