Why were yellow and red cards chosen for cards in football matches?

Why were yellow and red cards chosen for cards in football matches?