Nailing the colors (also nailing the colors to the mast or nailing the flag) is a practice dating back to the Age of Sail that expresses a defiant refusal to surrender, and willingness to fight to the last man. 
Striking the colors was a sign of surrender. Indeed, when cannon shots felled a ship’s flag, her opponent would cease firing and inquire whether she was capitulating. 
What were the surrender terms between Generals Ulysses S. Grant and Robert E. Lee at Appomattox Court House on April 9, 1865? I cannot find any specific mention of the colors, i.e., the lately controversial Confederate flag. Wikipedia has General Grant demanding, “The officers to give their individual paroles not to take up arms against the Government of the United States until properly exchanged, and each company or regimental commander sign a like parole for the men of their commands. The arms, artillery and public property to be parked and stacked, and turned over to the officer appointed by me to receive them. This will not embrace the side-arms of the officers, nor their private horses or baggage.” 
Later, on April 26, 1865, Confederate General Joseph E. Johnston would surrender his forces to William T. Sherman in North Carolina. General Richard Taylor’s forces in Alabama surrendered on May 4th. On June 2, 1865 General Edmund Kirby Smith surrendered the Confederate Department of the Trans-Mississippi. And on June 23, 1865, General Stand Watie surrendered his Cherokee forces to the Union army in Oklahoma.  However because these subsequent surrenders occurred after the April 14, 1865 intra-Republican Party coup d’état, their terms can be ignored. (Background: Blowback From Intra-Party Coup d’état, Ersjdamoo’s Blog, July 17, 2015.)
Letters were written between Generals Lee and Grant prior to their meeting at Appomattox Court House. These letters are dated April 7 through April 9, 1865. In those letters I again can find no specific mention of the Confederate flag. 
In his Second Inaugural Address delivered on Saturday, March 4, 1865, Abraham Lincoln concluded with these words:
With malice toward none, with charity for all, with firmness in the right as God gives us to see the right, let us strive on to finish the work we are in, to bind up the nation’s wounds, to care for him who shall have borne the battle and for his widow and his orphan, to do all which may achieve and cherish a just and lasting peace among ourselves and with all nations. 
I conclude from the above that Lincoln desired conciliation and that it is against the spirit of Abraham Lincoln to suddenly demand, ex post facto, that the South now must surrender its flag.
“Dixie” was a Confederate song. On April 10, 1865, the day after Lee’s surrender, enthusiastic crowds gathered at the White House. “At length,” wrote a reporter for the Washington paper Daily National Intelligencer, “after persistent effort, the presence of Mr. Lincoln was secured. Three loud and hearty cheers were given, after which the President, said in part…
I see you have a band of music with you. I propose closing up this interview by the band performing a particular tune which I will name. Before this is done, however, I wish to mention one or two little circumstances connected with it. I have always thought ‘Dixie’ one of the best tunes I have ever heard. Our adversaries over the way attempted to appropriate it, but I insisted yesterday that we fairly captured it. [Applause.] I presented the question to the Attorney General, and he gave it as his legal opinion that it is our lawful prize. [Laughter and applause.] I now request the band to favor me with its performance. 
This further complicates the issue of whether or not the Confederate flag had been captured. Was Lincoln saying tongue-in-cheek that the song “Dixie” was a “lawful prize” of the surrender? Or did he seriously mean what he said?
Add to this the precedent of the Confederate flag having flown for decades in the South after 1865, and one must ask whether a “statute of limitations” has expired. Only now, 150 years later, is a demand suddenly being made to yield the Rebel colors as a prize of war. I am not a lawyer and this issue is complicated. Perhaps knowledgeable legal experts can weigh in on the subject.
——- Sources ——-
 “Nailing the colours”, Wikipedia, July 21, 2015.
 “Battle of Appomattox Court House”, Wikipedia, July 21, 2015.
 “Grant & Lee: The Surrender Correspondence at Appomattox”, http://www.civilwar.org/battlefields/appomattox-courthouse/appomattox-court-house-history/surrender.html
 “Abraham Lincoln: Second Inaugural Address. Saturday, March 4, 1865. http://www.bartleby.com/124/pres32.html
 “April 10, 1865: President Lincoln Asks the Band to Play ‘Dixie'”, https://rhapsodyinbooks.wordpress.com/2009/04/10/april-10-1865-president-lincoln-asks-the-band-to-play-dixie/