Back in the era of the 1969 Stonewall Riots, the LGBTQ community was practically non-existent on the small screen.
And even if obstacles remain, significant strides have been made since then, especially in the past two decades.
In past fictional series gay characters were often ridiculed or caricatured, and sometimes portrayed as deviant or dangerous.
The 1967 television documentary "The Homosexuals" lays bare how television treated the community, says Robert Thompson, a media scholar at Syracuse University.
"Essentially it was still treating the idea of homosexuality as a disorder, that it was something that gone wrong," he said.
The "Television Code" -- a set of moral standards introduced to American TV in 1952 -- implicitly prohibited any reference to homosexuality in a positive light, an injunction that was abolished only in 1983.
The taboo also existed behind the camera.
"When I came to Los Angeles to write, you could not be an out writer on a staff. It just wasn't done," said Stan Zimmerman, who began screenwriting there in the early 1980s.
In that time there were more LGBTQ roles, though many were written as a way to focus on their sexual orientation rather than out of interest in the character.
In the early 1990s, American cinema -- which until then had taken a similar attitude to television -- made a decisive pivot with a series of films including "Philadelphia" and "My Own Private Idaho."
Television's watershed moment was in April 30, 1997: for the first time, the main character of a primetime sitcom, "Ellen," came out during an episode that went down in history.
The effect was heightened by the fact that the actress herself, Ellen DeGeneres, opened up about her own homosexuality at the same time.
The ultra-conservative pastor Jerry Falwell dubbed her "Ellen DeGenerate," as the episode prompted some advertisers to pull out, religious groups to organize and some sporadic demonstrations.
But reactions were largely positive, as the movement for better representation on television accelerated.
LGBTQ characters appeared on the series "Will & Grace," and later "ER," "Dawson's Creek" and "Spin City." In February 2001, the show "Buffy the Vampire Slayer" showed a lesbian kiss, a first for a hit series.
The public proved largely open to this sexual diversity, allowing viewers to feel represented for the first time.
"The bottom line with network television: it is all about money, so if they feel they can make money, they're going to put it on," Zimmerman said. "A lot of television works from fear."
- Cable, streaming open doors -
The new visibility of LGBTQ characters on television coincided with the emergence of more complex, cinematic television, including "The Sopranos" and "The Wire."
The advent of cable and streaming also opened up a new creative space -- the media environment now counts nearly 500 series, versus less than 100 when large networks had the monopoly.
The freedom of producers "not trying to appeal to a huge, mass audience" prompted major changes, Thompson said, with many more characters.
A touch over one percent of recurring characters on major US channels were LGBTQ in 2007-2008, according to the GLAAD gay rights association.
By 2018-2019, the proportion had jumped to almost nine percent -- almost double that of American adults who, according to a 2017 Gallup poll, say they identify with the community.
Since 2013, television has also opened up to transgender people, via "Orange is the New Black," "Transparent" and more recently, "Pose."
But more representation doesn't always translate to the real world, according to Candace Moore, a gender studies scholar at Carleton College in Minnesota.
"More positive representations of LGBTQ lives on television give us the false, but self-affirming, sense that we've obtained a cultural acceptance that is in fact fictional," Moore said.
Moore noted that since Donald Trump's presidential election the US has faced a renewed hostility toward sexual minorities, so "LGBTQ representation in scripted television probably presents a slightly sunnier version of what's actually going on in America right now."
Even on television, some barriers remain. In March 2018, the CBS series "Instinct" was the first on a large network to feature a gay main character, but leading roles still generally elude the LGBTQ community.
Youth programs have also proven sensitive territory.
A few series featuring teenagers have dared, including "PEN15," "Sex Education" and "One Day at a Time," but LGBTQ representation is even more rare for children's programming.
In May a local affiliate of the PBS public television network in the southern state of Alabama refused to broadcast an episode of the cartoon "Arthur," in which a recurring character marries another man.
Still, Zimmerman says progress is palpable.
"Now you do have gay, lesbian, trans writers, directors, actors," he said.
"Because we're all getting more opportunities, hopefully those opportunities will show up on screen or in film, to see how we're represented in all parts of our lives -- good, bad, funny sad -- not just one-dimensional characters and not just sidekicks."