The phrase is thought to have originated in the 16th century, when it was used to describe a ship that was able to sail quickly and easily through the water. The phrase was later adopted to describe other types of success, and is now commonly used in both formal and informal contexts.
When you use the phrase "with flying colours," you are conveying the idea that someone has achieved something with great skill, ease, or success. It is a positive phrase that can be used to praise or congratulate someone on their accomplishments.