Opponents of Lt. Gov. Dan Patrick's bathroom bill at the Capitol in Austin, Tex., last Wednesday. (Jay Janner/ASSOCIATED PRESS)

EARLIER THIS month, about the time some Texas Republican lawmakers introduced a bathroom bill, modeled on North Carolina’s, that enshrines bigotry by stigmatizing transgender people, the legislature in Austin extended an invitation to honor Rick Riordan, a best-selling author. Mr. Riordan, a native Texan, is a publishing phenomenon whose books, based on Greek, Egyptian and Norse mythology, are dependably inventive, entertaining and hilarious. Tens of millions of copies, including from the “Percy Jackson” series, have been sold in America and overseas, mainly to middle-schoolers.

A little homework by the legislators might have tipped them off that they were courting trouble. Almost immediately upon receiving the invitation, the courtly Mr. Riordan declined, succinctly:

“If they want to honor me,” he tweeted, “they could stop this nonsense.”

As vast numbers of young Texans could have told the lawmakers, lesbian, gay, bisexual and transgender characters, including demigods of Greek and Norse provenance, have played prominent roles in Mr. Riordan’s novels. They include Alex Fierro, a flamboyant, gender-fluid teenager whose ferocious courage is a theme in his most recent series, “Magnus Chase and the Gods of Asgard.” Among the fierce adversaries she confronts, and vanquishes, are a dragon, a giant and various wolves. Some other characters are at first suspicious of Alex, whose shape-shifting and gender fluidity tend to throw them, but eventually they grasp her unstinting grit and bravery, and warm up to her.

That would make a hopeful allegory for America’s flailing efforts to come to terms with its 1.4 million transgender people, although enlightenment may take a while in states like Texas, one of eight this year where lawmakers have introduced bathroom bills.

The legislation in Texas would make it illegal for transgender people to use public restrooms that don’t correspond to their sex at birth. As described by its champion, Lt. Gov. Dan Patrick (R), a former talk radio host, the bill strikes a blow against “political correctness” while promoting “privacy” and “safety” by barring what he imagines are predatory men, masquerading as women, from the ladies’ room.

In fact, privacy and safety are red herrings in the debate; Mr. Patrick’s lurid conjurings notwithstanding, there are virtually no confirmed cases of the sort he warns about. His bill, and others like it, are simply eruptions of intolerance in America’s ongoing culture wars, intended to marginalize transgender people.

With its booming convention, tourism and sports businesses, Texas stands to lose much more than most states in enacting such legislation, which could trigger the same sort of canceled business expansions, lost jobs and boycotts by major athletic organizations that North Carolina suffered after passing its bill. The price could run into billions of dollars. Many business leaders oppose the legislation, and top Republicans, including Gov. Greg Abbott, have kept their distance.

In the long term, acceptance for LGBT people is likely to expand, even in Texas, as legions of Mr. Riordan’s fans, and Alex Fierro’s, infuse the next generation of American leaders with an expanded spirit of tolerance.