As Dr. Rank enters the apartment, stage direction tells us that "it begins to grow dark." The darkness does not seem to bother Nora at this point because she and Dr. Rank are long-time friends, and there seems nothing strange in conversing with him even if the lighting is somewhat low. When he begins to suggest that he does not have much time left to live, Nora "grip[s] him by the arm" and grows clearly agitated and concerned.
Nora and Dr. Rank discuss the unfortunate fact that his father's indulgences during his lifetime seem to have affected Dr. Rank's own constitution. They talk of the rich foods, euphemistically referring, perhaps, to the man's intemperate sexual appetite. Nora purports to find this sad, and Dr. Rank seems to interpret her response as flirtation. Shortly thereafter, Nora shows him her silk stockings, which are "Flesh-coloured." She even gives him permission to look at the legs of the garment and playfully calls him "naughty."
It is only when Dr. Rank confesses that Torvald is not "the only one who would gladly give his life for [Nora's] sake," implying that he has feelings for her, that Nora asks the maid to bring in the lamp. She says that it was "really horrid" of him to have told her of his feelings. She claims that he "can do nothing for [her] now" and asks if he doesn't "feel ashamed" of himself, "now the lamp has come." The reason he ought to feel ashamed is because he did something socially unacceptable: confess his love to a married woman.
He told her the truth in the dark, and her response to learning something uncomfortable was to bring in the light. Nora cares about appearances, and she was raised as a "doll child" to become a "doll wife" as she says later on. The light is real, but it seems to me to represent society's expectations. Nora can flirt in the dark but when Dr. Rank goes too far, and becomes too intimate, she must put a stop to it. He cannot say such things if she is going to maintain her relationship and be the perfect, dutiful wife to Torvald.