The photograph of rainbow lights displayed on the White House is real, and marked the Supreme Court's decision on gay marriage in 2015.
The photograph of the American flag displayed on the White House in 2017 is a fake.
A photograph purportedly showing the American flag displayed on the White House was circulated on social media over 4th of July weekend in 2017:
This image was frequently shared in a meme which purported to compare White House displays from President Barack Obama in 2016, then President Donald Trump in 2017:
The image showing a rainbow display on the White House is real, but it did not occur in 2016, although it did take place during the Obama administration. They were actually displayed in June 2015, marking the Supreme Court's decision affirming same-sex marriage:
"I had a chance to do the Rose Garden celebration of the court decision around same-sex marriage," the president told CNN's Jim Acosta.
"I did not have a chance to comment on how good the White House looked in rainbow colors. That made it a really good week. To see people gathered in an evening outside on a beautiful summer night, and to feel whole, and to feel accepted, and to feel that they had a right to love, that was pretty cool."
The image showing the American flag displayed on the White House is a hoax that first appeared in June 2015, shortly after the White House was lit up in the aforementioned rainbow display. The web site Zwinglius Redivivus was one of the pages that shared the doctored image in an article calling on President Obama to light up the White House with patriotic colors, not rainbows:
You can illuminate it with the colors of the American flag. We expect you to do it tonight. Elsewise, your concern isn’t to be the President of the Country, but only of a tiny minority within it.
This American flag display is a digitally altered image based on a 2007 photograph bathed in a plain white light. For comparison, here is the altered image (left) and the original image (right):
— Donald J. Trump (@realDonaldTrump) July 5, 2017
The White House is lit with various colors to mark different occasions throughout the year. President Donald Trump lit the White House blue to commemorate Peace Officers Memorial Day in May 2017. Similarly, President Obama lit the White House pink for breast cancer awareness month.
This meme gives the impression that the White House was never lit red, white and blue during President Obama's administration, which is demonstrably not true; in November 2014, the White House was illuminated red, white and blue for an event called "Salute to the Troops: In Performance at the White House".
Further, the Obama administration typically held large July Fourth celebrations with fireworks and musical performances, and did light up the White House in patriotic colors. However, we could not find a photograph of the White House lit up red, white, and blue on that exact date during Obama's administration.