Since the eighteenth century, ships of the navy have used flags to communicate their status or well-being.
The most prominent flag, of course, is that of the ship’s country, but there are dozens of other banners, which are called “colors.”
The most elaborate use of this bunting is after a victory at sea, when a triumphant ship returns to its home port with a proud and full display of flying colors.
We say that someone who has overcome an obstacle with ease has passed with “flying colors”.