Jonathan Groff has appeared in plenty of projects onscreen and onstage — “Looking,” “The Normal Heart,” “A New Brain” — that may well have helped pave the way for the Supreme Court decision that legalized same-sex marriage. But in reacting to the news of the ruling, Groff’s thoughts went to the years of activism that led to this moment.

“I didn’t expect to be as genuinely emotional and excited about being an American as I am today,” he said. “I just feel so grateful to all of the activists. I’m benefiting from the decades of turmoil and frustration and work that has been done on my behalf. Now it’s official, and it’s mind-blowing to me.”

With the finale of “Looking” still being written (as a movie that wraps up the HBO series in which Groff starred), the actor feels sure the Supreme Court decision will make its way into the script. “I haven’t seen any of it yet,” he said. “But it’s always been the intention of the project to address what’s happening in the world right now, so I assume this ruling will be part of it in some way.”

As he sees it, the entertainment industry’s role in social change is to serve not as an impetus for real-world work but as a chronicle of it. “I think of ‘Looking’ as more of a reflection of what’s happening,” he said. “For my money, the activists who have been fighting so hard for decades for this legislation, those people are the real heroes.”

While gearing up for a Broadway run in buzz-magnet musical “Hamilton,” Groff is currently starring in a concert staging of “A New Brain,” the 1998 William Finn-James Lapine musical about a man struggling with a brain disorder. In the show, his character is supported by his loving boyfriend.

“There’s gay men singing love ballads to each other,” he said. “I’m so excited to get to the theater tonight and sing those songs. It’s my dream way to celebrate.”