Same mesh with different colors
You have a couple options:
One material:
You can set a unique index per object in Properties &gt; Object &gt; Relations:

Using the Object info node, you can get this value in the node tree and use it to mix colors (or shaders) accordingly (also see Get &quot;Object Color&quot; property in Cycles).
Using three linked cubes (duplicated with AltD) with the same material as an example:

Note that this node setup is a lot cleaner and easier to manage when node groups are used.
Multiple materials:
By setting the material to link to that specific Object instead of it's data, which is shared by the other linked objects, you can have separate materials on separate objects which share the same mesh/data.
Just select Object in the menu to the right of the material selector: