I find being able to identify the correct key first time useful so have a rubber key cap on my front door key. This split with age and I was able to fix it back together with a small amount of Sugru.
I was able to use red Sugru straight from the packet, but blending 2 or more colours together is possible if an exact colour-match is necessary for your project / fix. The retail packaging of Sugru even comes with a handy colour chart to make this colour matching easy.
Working a small amount of Sugru in the hands softens the material up ready for application.
I placed the Sugru on the inside rim of one half of the broken key cap.
Position the door key in it's recess on this Sugru'd half cap.
Place the other half of the key cap over this key, being sure to line up the key-ring hole.
Press firmly into position.
Any excess Sugru that oozes out can be scraped off with a blade to give a nice flush edge.