"With flying colours" is a popular idiom of the English language that is used to describe how well someone has completed a task. For example, a common use of the phrase is to refer to someone having passed a test or other examination "with flying colors," i.e. passed the test easily or with an exceptionally high score. The phrase originated in the Age of Discovery, when ships would return to port with their flags either raised or lowered to signify that the ship had either been successful or defeated, with raised flags indicating success and lowered flags indicating defeat. Thus, "with flying colors" literally means that someone has completed a task, although idiomatically connotes particular success in that task.
History
Ships serve scientific and cultural needs, as well as the transportation of goods, and resolving political and national conflict. In the past, without the use of modern communication devices, a ship's appearance upon the immediate return to the port could communicate how the crew fared at sea. Ships that were victorious in their endeavors – e.g. an encounter with an enemy ship – would sail into port with flags flying from the mastheads. A ship that had been defeated, on the other hand, would be forced to "strike her colours", or to lower their flags, signifying defeat. This practice was particularly relevant in the Age of Discovery, and prior to the 18th century the phrase was used solely as a nautical term. Later, it began to be used in the vernacular to signify any kind of triumph. Another phrase, "go down with flying colours" or "go down with colours flying" evokes a resolute crew fighting, even until their ship sinks. As an idiom, it means that someone has failed at something even while putting great effort towards it. A variant of this phrase is "Nail your colours to the mast," and means that someone has done something to irreversibly commit themselves to a task or matter; referencing that by literally nailing the flags to the mast, the flags cannot be taken down to signify defeat. The word "colours" is a common way to describe flags and insignia of military units. Flags or insignia may be referred to as colours in non-military contexts to express patriotism and nationality; other such examples of phrases include "true colours", or "show your colours". Flying colors, of course, refers to the unfurled flags' position on the masthead, and the variants come off... or pass... simply mean to have returned from the sea and to pass into the harbour, respectively. Similarly, the phrase "sailing under false colours" was a reference to a tactic used by pirates or maritime robbers. By hoisting a friendly flag, the unsuspecting ship would allow the pirates' ship to approach without resistance, giving the pirates access to board their vessel. Edward Teach, the pirate known as Blackbeard, famously did this, and sometimes upon sight of their ship, with a pirate flagreplacing the deceptive friendly one, the ship would immediately surrender. However, this was not limited historically to pirates, as the Royal Navy had used this tactic when chasing Bartholomew Roberts.
Usage
These phrases have been used many times in literary works, even in modern-day writings. "With flying colours" has many variations preceding it, such as to pass..., came out..., and came through..., but all have essentially the same meaning derived from the allusion to nautical triumph or victory, honor, or public success. "Go down with colours flying" and "Nail your colours to the mast" are used similarly to the nautical allusion, and are phrases to express persistence or stubbornness. "Sailing under false colours", consistent with its nautical origin, is another way to express deception, or to mislead or mystify.