It was meant to be a secret, and the company had planned a big reveal to share the news with the world. The excitement was palpable, and the announcement was supposed to surprise its closest followers.

But in this day and age of social media and covert sources, it’s difficult to keep anything under wraps for very long.

And when Boston resident Frank Hegyi learned what was in store, he decided to blow the lid off the whole thing.

As crayon-maker Crayola was gearing up to pull back the curtains Friday morning — it’s National Crayon Day — and reveal the retirement of one of its many crayon colors, an event the company hoped would draw widespread response from coloring fiends and crafty customers alike on social media, Hegyi, a Northeastern University employee, beat them to the punch.

After Hegyi’s mother stumbled upon a box of crayons at a Target store in New Jersey that hit the shelves too soon and revealed the color being phased out, she reluctantly sent a picture of the box to her son.

Hegyi, in turn, posted the picture to social media Thursday, much to his mother’s chagrin — and the surprise of the crayon manufacturer.

The reveal seemed to send Crayola scrambling. Shortly after Hegyi’s Twitter post appeared online, the company put out a video announcing that “Dandelion,” a yellowish crayon that became part of Crayola’s arsenal in 1990, and later landed in its prestigious 24-pack of coloring tools, would be hanging up its coat.

Crayola put the best spin possible on the announcement, which was supposed to happen via livestream on Facebook Friday, from New York’s Times Square. The event went on as planned, but the biggest news was already out there.

“Our beloved Dandelion decided to announce his retirement early!” the company said on Twitter Thursday, roughly an hour after Hegyi’s tweet. “There’s no taming an adventurous spirit!”

In a followup statement, a company spokeswoman brushed off the blown secret as a case of a crayon that just couldn’t wait to bid farewell.

“Dandelion was so excited to announce his retirement he snuck a few packages out of the factory and onto the shelves,” said Crayola’s Alison Deasy in an e-mail. “One lucky fan came across the box and couldn’t wait to share the news with the world, and neither could we!”

Crayola has a tradition of swapping out colors and announcing new ones, a move that, surprisingly to some, is met by much fanfare.

(For example, during the livestream on Facebook Friday, nearly 3,000 people tuned in, with many expressing in the comments section their sadness to bid farewell to the yellow stick).

Nearly three decades ago, Crayola put the kibosh on eight of its crayon colors and sent them to the “Crayola Hall of Fame,” a thing that actually exists. That first-of-its-kind move made way for eight new ones, including Dandelion.

And in 2003, as part of the company’s centennial celebration, four others went away: blizzard blue, magic mint, mulberry, and teal blue. Those, too, were replaced by newer options.

Similarly, as Dandelion flees the 24-pack, a new color will take its spot. The company is getting ready to introduce a crayon with a blue hue. Customers will get the chance to name the color during a contest that will launch this summer.

As for Hegyi, he explained what led him to spilling the beans: His mother, a graphic designer in New Jersey, had started an office pool with coworkers about which crayon would be retired.

The crayon pool was “very serious,” so she went to Target to grab a box for research. While perusing the crayon aisle, he said, she stumbled across the “incriminating packaging,” revealing that ‘Dandelion’ was, in fact, the retired color.

“She doesn’t have strong feelings about Dandelion, but was relieved that it wasn’t Cerulean,” he said.

Feeling guilty about the secret she was now harboring, Hegyi’s mother withdrew her $1 from the office pool. Rumors swirled that she had insider information, Hegyi said, and people wanted to know the truth. Her sister implored her to make the news go viral.

“NOOO, I might get death threats,” Hegyi said his mother told him. “I might get someone fired at Target.”

After some coaxing, Hegyi got her to send the photo to him. Then he leaked it.

Perhaps it was all a big marketing scheme. Or perhaps, it was an honest mistake. Either way, Hegyi said his mother would take it all back.

“She wishes she had taken the incriminating boxes up to the customer service desk at Target and told them, ‘These shouldn’t be out yet,’ ” he said.

He added, “I feel bad about any extra work I made for Crayola marketing staff, but in the world of corporate social media, you gotta play the cards God dealt you.”