In 2012, wild-child pop diva Kesha hit a high point with her dirty, glitter-soaked rock album, Warrior.

She’s spent the past five years in silence, embroiled in a grueling legal battle with her most frequent collaborator, superproducer Dr. Luke, whom the singer accused of physical and emotional abuse.

On her excellent comeback record, Rainbow, Kesha channels that drama into the best music of her career – finding common ground between the honky-tonks she loves and the dance clubs she ruled with hits like “Tik Tok” and “Die Young,” between glossy beats, epic ballads and grimy guitar riffs.

Above acoustic guitar, her once-Auto-Tune-weary vocals breathe easy as she nimbly and confidently shows off her underappreciated range, singing, “Don’t let the bastards get you down.” It’s followed by the glam-punk kiss-off “Let ‘Em Talk,” w she’s joined by Eagles of Death Metal.

Kesha executive-produced the album, working with a team that included everyone from Ryan Lewis to Ben Folds to her mom.

Rainbow is full of sympathetic prisoner metaphors and therapist clich├ęs: “Live and learn and never forget it/Gotta learn to let it go,” she repeats on “Learn to Let Go.” Luckily, she also showcases her absurdist sense of humor.

The album’s most powerful moment is a cover of the 1980 Dolly Parton ballad “Old Flames” – Sebert’s biggest country hit as a songwriter.