There are lots of tutorials to clean white earphone wires but those are made of rubber or plastic. How should a cloth-wire earphone be cleaned without damaging it?
Because wiring is involved (though it's a very low voltage), you may want to head over to the Electrical Engineering board; they're very helpful. Okay, this is what I would do... Use a black permanent marker to color the cloth part. Use one of the big ones, because it will be much easier, and faster, and you'll probably have to go over it to catch the missed spots. A permanent marker dries very quickly, so don't "soak" the cloth, better to let it dry. I've done this on clothing, like jeans, that have accidentally been splashed by bleach. I'm not sure what kind of wiring runs through the cloth covering (maybe loose, most likely covered in plastic), but it shouldn't hurt them. Again, check with the EE people if you're uncomfortable with this. As far as where the wire meets the white plastic, you could put tape over that part, though the absorbancy of the cloth will probably make the marker migrate just to that point, when you get closer to the ends. This looks like nylon cord, which I've "markered" to use for wrapping gifts. The cord looks fine to me, so I probably wouldn't do anything. If I did color it, it would be in purple, because I'm from New Orleans, and we're crazy down here. :)