At a time when Greg Berlanti’s “Love, Simon” is belatedly bringing the subject of adolescent homosexual desire to the mall-movie crowd, along comes “Rafiki” to remind us that LGBT narratives in the mainstream are not to be taken for granted. Many international viewers would identify nothing especially subversive in Kenyan writer-director Wanuri Kahiu’s pure-hearted, candy-colored tale of first love blooming between two teenage girls in the rough streets of Nairobi. Yet at home, where homosexuality remains a criminal offense, “Rafiki” has been slapped with a ban for its positive representation — a state of affairs that makes this lively, brightly performed film impossible not to celebrate, even as its decidedly conventional script skimps on richer dramatic opportunities.

Even without the sympathetic controversy engendered by the ban, this Cannes Un Certain Regard entry would be a shoo-in for the LGBT festival circuit and distribution market, in which African queer films remain all too few and far between. Yet while “Rafiki” will receive some international arthouse play, it’s a film that would be most aptly and valuably targeted to the generation about which it has been made, who will hopefully find it through streaming avenues in years to come. For Kahiu, this sophomore feature should secure enough exposure to enable further, more ambitious vehicles for her direct, Afropop-infused style.

Kahiu and her South African co-writer Jenna Bass have adapted a short story by acclaimed Ugandan author Monica Arac de Nyeko, and the themes and tensions raised in “Rafiki” certainly apply broadly across multiple African borders. That said, the film’s unromanticized but vibrantly specific sense of place is among its most appealing assets.

In a bustling ghetto on the outskirts of the Kenyan capital, known informally as “the Slopes,” protagonist Kena (Samantha Mugatsia) is introduced lithely skateboarding through streets fizzing with gossip and activity: Kids hula-hoop in the road, barbers line up fresh fades on the sidewalk, hot pink leopard-skin sheets dry on the line. An academically gifted tomboy with no female friends, Kena spends her free time playing soccer and shooting the breeze with the raffish Blacksta (Neville Masati) and his gang — who blithely refer to her as “one of the guys,” yet never for a moment consider that heterosexual romance might not be on her mind.

Kena’s social crowd is a source of consternation to her embittered schoolteacher mother Mercy (Nini Wacera), acrimoniously divorced from her more liberal-minded father John (Jimmy Gathu), a shopkeeper running as a candidate in upcoming local elections. Mercy is delighted, then, when Kena begins hanging out with Ziki (Sheila Munyiva), a charismatic, well-to-do girl with a veritable firework of pastel-colored braids on her head — who just happens to be the daughter of John’s more conservative election rival. Little does Mercy know that her daughter’s posh new friend is rather more than that. The girls’ mutual infatuation is intense and almost instant, though expressed only in innocent kisses and close but clothed contact: Their sweet sexual naivete feels fully character-informed rather than censor-compliant.

That doesn’t stop more salacious ideas spreading swiftly through the community — a hotbed of church-instilled homophobia — as the two politicians’ daughters are seen together in public, culminating in violent discord both at home and in the streets. Kahiu and Bass outline these conflicts in the broadest possible terms, with flatly declamatory dialogue underlining characters’ opposing ideologies, rather than letting them emerge through character nuance and incident; even the two young lovers, united in their shared ambition not to be “typical Kenyan girls,” tell each other their feelings more than they show them. Shades of gray are understandably few in a film with such urgent political purpose, though John’s tender, non-judgmental relationship to his daughter stands out for its unspoken currents of concern and understanding; the tension between his obligations to family and politics might have been explored in more depth.

Even when “Rafiki” irons out its emotions a little too neatly, however, Mugatsia and Munyiva’s relaxed, sparking chemistry quickens its heartbeat. Both actresses are naturally, beguilingly expressive in ways that can override their clunkier dialogue, with Christopher Wessels’ sensitive, generously lit lensing letting their marvelous faces carry many a key scene.

The filmmaking here is generally as straightforward and message-serving as the scripting, though Kahiu’s funkier, more expressionistic flourishes tend to pay off handsomely. One lovely nightclub scene bathes Kena and Ziki in blacklight, casting them as wild neon-pink entities in the darkness, and finding an outward expression for the hot, briefly iridescent euphoria that first love — particularly one daring to speak its name in a still-hostile environment — makes us feel inside. “Rafiki’s” soundtrack may be dominated by wispy local balladry, but it’s hard in this scene not to think of a recently defiant Janelle Monáe lyric: “Boy it’s cool if you got blue/We got the pink.” Long may these girls keep it.