In a matter of hours on Monday, a tweet and an offensive Halloween costume sparked allegations of racial discrimination at Bon Appetit, causing a shakeup at the food magazine.

By the end of the day the outlet’s editor-in-chief Adam Rapoport resigned.

“I am stepping down as editor in chief of Bon Appetit to reflect on the work that I need to do as a human being and to allow Bon Appetit to get to a better place,” he wrote in an Instagram post.

“From my extremely ill-conceived Halloween costume 16 years ago to my blind spots as an editor, I’ve not championed an inclusive vision,” he continued, apologizing for his “failings.”

There were several factors leading up to Rapoport’s resignation, among them a claim by popular Bon Appetit assistant editor Sohla El-Waylly that the company only paid white editors for their appearances on Bon Appetit’s Test Kitchen series.

“I’ve been pushed in front of video as a display of diversity,” she wrote in an Instagram Story. “None of the people of color were compensated.”

In response, senior food editor Molly Baz noted that she wouldn’t appear in any videos until her colleagues of color received equal pay. Food editor at-large Carla Lalli Music posted a similar promise.

El-Waylly, Baz and Lalli Music did not immediately return messages for comment.

Bon Appetit denied that only white editors were paid for their video appearances.

“It would be inaccurate to report that only white people were paid for video appearances,” Molly Pacala, a spokesperson for Bon Appetit and its parent company Condé Nast, told The Post on Monday.

However, Condé Nast’s head of programming Matt Duckor admitted in a series of tweets late Monday that not everyone was paid for their video work and that would change going forward.

“I take responsibility for my part in this flawed system and will be an ally with my BIPOC coworkers to create a more equitable one that values all employees, whether it be for their writing, recipe development or video work,” Duckor wrote. “I demand that everyone appearing on camera be compensated accordingly for their work immediately.”

Many have long argued that more conversation around what everyone makes — in any workplace — will inevitably lead to a more equitable environment. If everyone knew some of their colleagues were being paid more, and some not at all, could some of the problems at Bon Appetit have been avoided?

To date, a lot of conversation about pay transparency has focused on gender, but it has serious implications in pay disparity among minorities as well.

In general, workers who earn less at the start of their career — often women or people of color — will continue to be at a disadvantage when negotiating for pay at a new job and consequently, will likely receive lower salaries throughout their career.

“We know that women and people of color earn less on average in this country. ... Absent a policy of mandated peer earnings disclosure, we would expect them to be more likely to negotiate a lower wage at a new job than others — even when performing the same exact work,” Emiliano Huet-Vaughn, an assistant professor of economics at Pomona College who researches pay transparency, wrote in an email. “There is also direct sexism and racism workers may face from hiring managers.”

“Formal pay transparency requirements can give workers an alternative and common reference point in bargaining beyond their own previous (and uncommon) outside options, letting potential workers see how firms have previously valued a job, and, in principle, mitigating gender and racial wage gaps,” Huet-Vaughn wrote.

That doesn’t mean you have to ask everyone you work with what they make and tell everyone what you earn, but companies could use more transparent pay structures and guidelines, experts say.

Liane Davey, an organizational psychologist and author of “The Good Fight: Use Productive Conflict to Get Your Team and Organization Back on Track,” encouraged executives and managers to use this period of shattered norms to investigate claims of unfairness and discrimination, intentional or not.

“It would be exploitative to pay one group of employees for public appearances and to expect others to do them for free for the ‘exposure,’” she said.

“Regardless of how perfect and pristine your policies are, it’s possible managers are violating them,” Davey said. “Even if your compensation programs were seen as best practice a month ago, things are changing. You need to be vigilant about ways your organization systemically discriminates against people.”

Part of this examination means looking at percentage-based merit increases, which “not only perpetuate, but amplify initial pay inequities for marginalized groups,” Davey said.

In addition, she advises that companies should “search for discrepancies in what does and does not count for overtime, bonuses and other forms of extra compensation.”

“We’ve reached a reset point when you need to ask whether systemic racism, misogyny and other forms of bias have ensured that women and BIPOC can never reach parity using this equation.”

The paid-leave pioneers: A few Japanese dads have sparked a child-care revolution

The country’s paternity leave is among the most generous in the world. These men are trying to inspire dads to actually use it.

Dads are less likely than moms and people without kids to be laid off during the pandemic, new research shows

The ‘fatherhood premium’ is at play

She asked to vote remotely to protect her newborn — but was denied. So she brought her baby to the California House floor.

Buffy Wicks cast the deciding vote on a critical family leave bill