in june 2012, it was revealed that rihanna would star as the lead role in the film "happy smekday!", alongside american actor jim parsons. in september 2012, 20th century fox and dreamworks animation announced that the movie will be released for november 26, 2014. in june 2013, the film was retitled from "happy smekday!" to "home". in 2014, "variety" magazine reported that, in addition to her voice role, rihanna created a concept album for the film was released on march 23, 2015. it was later revealed that the film's soundtrack would also include songs recorded by charli xcx, kiesza and jennifer lopez. "dancing in the dark" was written by tor erik hermansen, mikkel storleer eriksen, ester dean, maureen anne mcdonald and rihanna. the production was done by hermansen and eriksen under their production name stargate. dean has previously co-penned a number of songs for rihanna including, "s&m" (2011) and "rude boy" (2010), both of which were produced by stargate. the vocals were recorded by marcos tovar and kuk harrell, while the later also did their production. phil tan mixed the song at the ninja beat club in atlanta, georgia while daniela rivera served as the track's engineer.