What is the meaning of "paint it black" and when to use it?
Solution 1:
It would appear that you underestimate the cultural significance of the Rolling Stones!
A quick search for the phrase's history (via Google nGrams) shows that it was not an idiomatic phrase before the song was released in 1966: except for a Southerner opposed to civil rights in the 1920s ("We will paint this State red before we paint it black") and a reference to national colors ("It would be just the same if Ireland began to paint the map green or Montenegro were to paint it black"), (almost) all the pre-1966 instances I find are literal references to actually putting real black paint onto things. It's only after the song became iconic that "paint it black" became an idiomatic expression.
All of the imagery in the Stones song is to death and its accompanying sadness; black is the color of funerals in England, and at least one verse ("I see a line of cars and they're all painted black / With flowers and my love both never to come back") is an explicit reference to a funeral cortege. Using "Paint it black" as the fire-at-will signal is sardonic, and makes excellent television - but is probably not in common usage. (I haven't watched the episode yet, so don't know who was giving that order - if it was, for example, a police/SWAT commander, use of a command like that would likely result in suspension from duty, since the police are supposed to be preventing funerals rather than causing them. A military commander in a war zone might get away with it. It sounds, however, like something the "bad guy" would say.)
It's a pop-culture reference which has become an idiom; the characters in "Elementary" are assumed to know the song and understand its meaning. (Most people in North America and the UK, between the ages of 30 and 65, have heard the song at least a dozen times.) To people from elsewhere, or from a different generation, it has no obvious meaning and should probably be avoided if you wish to avoid misunderstanding.
Solution 2:
I have never heard this phrase before but considering your context is a conversation wherein a sniper is receiving orders to take a shot, I have a strong suspicion that this may be referring to thermal imaging.
On thermal imaging, heat sources shine bright colors. Often reds and yellows. Things like people and machines stand out against a background of colder objects which are often represented by a dark green or black color.
Taking a shot and killing someone would turn their red thermal image into a black image as their body cools.
You could say the sniper is painting the image black.
Military lingo is full of "colorful" phrases and idioms. Though I have a gut feeling that this may be a writer's idea of military lingo rather than actual slang.