Striking the colors, meaning to lower the flag (the "colors") which signifies a ship's or garrison's allegiance, is a universally recognized indication of surrender, particularly for ships at sea. For a ship, surrender is dated from the time the ensign is struck.
"Colours. A national flag (or a battle ensign). The colours . . . are hauled down as a token of submission."
International law absolutely requires a ship of war to fly its ensign at the commencement of any hostile acts, i.e., before firing on the enemy. During battle there is no purpose in striking the colours other than to indicate surrender.
It was and is an offense to continue to fight after striking one's colours, and an offense to continue to fire on an enemy after she has struck her colours, unless she indicates by some other action, such as continuing to fire or seeking to escape, that he has not truly surrendered. For this reason, striking the colours is conclusive evidence of a surrender having taken place in the case of a warship, but not in the case of a merchant ship. What would be perfidy in the case of a warship is not in the case of a merchant ship: A merchant ship may strike its colours as a ruse de guerre in an attempt to escape capture, since it does not engage the enemy in combat.
In distinction to striking one's colours, hoisting a white flag, in itself, is not an indication of surrender. Rather, hoisting a white flag indicates a request for a truce in order to communicate with the enemy. Under the Geneva Conventions, persons carrying or waving a white flag are still not to be fired upon, nor are they allowed to open fire.
Nailing the colors to the mast is a traditional sign of defiance, indicating that the colors will never be struck, that the ship will never surrender. On 23 September 1779, Capt. Richard Pearson of HMS Serapis, nailed the British ensign to the ensign staff with his own hands before going into battle against Continental Navy ship Bonhomme Richard. He had to tear it down himself when surrendering.