Kenya Barris, creator of ABC’s “black-ish,” was motivated to write the comedy about an African-American family’s efforts to honor its heritage in part by the unreality of what he grew up watching on television.

“I saw ‘Friends’ and ‘Seinfeld’ and thought, ‘What part of New York is this?’” recalled Barris, who is black. “It’s not about being diverse. It’s about being true to the world.”

His show comes 15 years after civil rights groups, galvanized by a lineup of new network series almost entirely devoid of minority characters, sought and ultimately won agreements from major broadcasters to put programs on the air that better reflect the nation’s population.

An AP analysis of regular cast members on prime-time comedies and dramas on ABC, CBS, NBC and Fox found progress since then in hiring black actors, but slighted other minorities. Casts at three of the four networks are still whiter than the nation as a whole.

That’s in contrast to a fall 2014 season that seemed to signal broad change. Besides “black-ish” and a trio of shows from black megaproducer Shonda Rhimes, it offered Asian-American crime fighters and Latino families.

Among the key findings of the AP analysis:

— ABC, NBC and Fox now have a higher percentage of blacks in prime time than there is in the general population — a significant change over 1999. The difference is most dramatic at Fox: 6.5 percent of characters in lead or supporting roles were black in 1999 to 21 percent black this past fall, a number that notched up again with January’s premiere of “Empire,” a drama about an African-American family’s music dynasty.

— Other ethnic groups don’t do nearly as well. While Latinos are the nation’s largest minority group at more than 17 percent of the population, only Fox and ABC have Latino representation of as much as 10 percent.

— CBS, the nation’s most popular network, had the most diversity 15 years ago and now has the least. CBS programs are whiter now than they were then.

Time has not made broadcast’s role moot. Network fare remains dominant for most consumers despite an explosion of niche cable channels and streaming services that cater to seemingly every possible demographic. What Americans see — or fail to see — on the networks has a powerful impact on how individuals regard themselves as part of the nation’s mosaic.

Gina Rodriguez, the Golden Globe-winning star of the CW’s new telenovela-inspired comedy “Jane the Virgin,” knows what it’s like to be left out of the TV picture.

“Ten years ago, when I was looking at that screen and didn’t see myself at all, I knew there was no place (for me). Or I was too out of the box, too much of a risk,” she said. “People say this (show) is too much of a risk. … Which is so sad, because it’s the same story, just told by a new face.”

Changing attitudes

In 1965, after NBC cast Bill Cosby in “I Spy,” young Kweisi Mfume’s mother sent her son to knock on doors in their Baltimore neighborhood to spread the word: “There’s a colored man on TV!” Cosby had become the first black to star on a network drama. In 1999, as head of the NAACP, Mfume was among the leaders pressuring networks on diversity.

“One can make the argument it’s been progress over 15 years, but it’s still been 15 years and that’s a lot of time to go by to see some of these changes incrementally,” said Mfume. “We can get pleasantly and romantically drunk by looking at all (Rhimes) is doing. … But at the same time, she’s one person at one broadcast network.”

Hollywood’s commitment to diversity has been an issue on numerous fronts in recent weeks: Not a single Oscar nominee in an acting category is black, and the critically acclaimed “Selma” got just two Oscar nods for best picture and best original song. Emails exposed by the Sony Pictures hacking revealed racist jokes referencing President Barack Obama by Amy Pascal, head of that studio’s film division. Comic Chris Rock wrote a detailed essay for The Hollywood Reporter saying that entertainment is a white industry, “just as the NBA is a black industry.”

Granted, TV history contains minority success stories. Desi Arnaz loved Lucy in the 1950s; “Good Times,” “The Jeffersons” and “Chico and the Man” were popular in the 1970s, the same decade that the “Roots” miniseries set viewership records; and Cosby was TV’s father figure in the 1980s.

But whether due to timidity or cluelessness on the part of executives, or segregation unwittingly enabled by the growth of niche networks, that picture did not translate to lasting diversity on the networks. By the fall of 1999, ABC, NBC and Fox each had prime-time casts that were 86 percent white — at a time when the U.S. Census put the non-Latino white population at 71.9 percent.

In fall 2014, with the non-Latino white population estimated at 62.6 percent, CBS’ series cast and characters were 79.2 percent white; ABC’s were 72.7 percent; and NBC’s were 69.7 percent. In contrast, Fox’s slate stands at 60 percent white.

The Census Bureau counts blacks as 13.2 percent of the U.S. population. Blacks made up 15 percent of cast members in fall shows on ABC and NBC.

“We try to make sure the numbers we have reflect our society,” said Karen Horne, NBC’s vice president of programming talent development and inclusion. “We’re servicing people we’re broadcasting to.”

Dana Walden, chairman and CEO of the Fox Television Group, said race wasn’t even brought up when she was told that Nicole Beharie, who is black, was cast as the female lead in “Sleepy Hollow.”

“To me, that represents a quantum leap from where I’ve seen this industry start when I was a young executive,” Walden said.

Stephanie Beatriz, who plays a police detective on Fox’s sophomore comedy “Brooklyn Nine-Nine,” worked extensively in theater and enjoyed the freedom of appearing in a range of “colorblind” stage roles as well as playing specifically Latina characters.

“Then, coming to L.A., I realized there’s still a lot more narrow-mindedness in where I’m ‘allowed’ to fit in. But at the same time I do see it changing,” said Beatriz, one of two Latinas in her show’s nine-member ensemble. “There’s been an explosion of different types of people in television.”

CBS casts whiter

Such even-handed treatment is what the NAACP and other groups sought. In response to a hearing held by that group in 1999, top CBS boss Leslie Moonves pledged improvement.

“We’re not only putting it in writing,” Moonves said. “We’re putting our money where our mouth is.”

But CBS’ Fall 2014 lineup did not show improvement: The number of white characters was up, and black representation had slipped to just under 7 percent, less than half what it was in 1999, according to the AP’s tally from the network’s own cast lists.

“We are victims of our own success to a certain extent,” said CBS Entertainment President Nina Tassler by way of explanation.

CBS has been the most-watched network in prime time for much of the past decade and, as a result, has had less programming churn. The network’s audience is also older than its rivals. All of that is a recipe for conservative program and cast choices, while a network with more series turnover, like ABC, is apt to take more chances.

When CBS launched a new comedy about an Irish-American family from Boston (“The McCarthys”) this fall, all the stars were white. “Mom,” another CBS comedy, also has an entirely white cast.

But Tassler (who is a Latina) said the network has not become complacent about the issue and makes diversity a big part of its casting discussions. “What I think is most important is keeping the conversation going, never feeling like it’s ‘mission accomplished,’” she said.

Associated Press writers Lynn Elder and Frazier Moore contributed to this article.