The theme of a work of art or literature can be more subtle than its subject. The subject is the main topic, while a theme may have deeper undercurrents or be unspoken. The setting is the time and place where the piece is set. It is the culture and society that shapes the story.
The setting is important to the theme because some settings are better fitted to certain themes. The setting conveys a sense of atmosphere, which helps convey the more implicit elements of a theme. The society in which a narrative is set shapes the mentality of the characters, their behaviors, and their responses to their environment, also contributing to a specific theme.
For example, Shakespeare’s play A Midsummer Night’s Dream is set in ancient Athens. Much of the action takes place in the woods beyond the city. One of its themes is the madness of love, which is portrayed through fairy magic and love potions. The setting makes sense because it is a classical place and time, full of taboos that thwart lovers as well as mythological figures who add to the story’s sense of wonder. The forest is a perfect location for the fairies to dwell and the lovers to flee because the wood is a wild, primitive place outside the realms of civilization. It represents the mysterious, dark, and sometimes wonderful subconscious. There is actual enchantment, and then there is the bewitchment of love.
As you can see, a story’s theme and setting are intertwined, and, if written well, the two complement one another.
First be sure that you understand 'theme' and 'setting.'
Theme: The subject being discussed in the story.
Setting: Where the story takes place.
When reading any story, you are receiving a message. This message is the theme. The effectiveness of that message relies heavily on the package in which it is delivered. This package is the setting.
For example: If you wanted to write a novel which discusses the development of artificial intelligence (theme), you would pick either a futuristic setting in which that intelligence is already achieved, or a modern-day setting in which it is still on the cusp of a breakthrough. In this way your theme is decided. It is the setting you choose which will affect how that theme is presented.
Theme is the purpose the writer has for writing. It is sometimes called "the message" the writer wants to send to the reader. The setting is where the story takes place. Another way to say setting is the physical environment, which may also include the time the writing takes place. For example, we can say a story is "set in the south in the 1930s," or a story takes place in New York City at the turn of the century. Just as we can put the same message inside different colored envelopes, a writer can send the same message through different settings. The best stories weave the theme into the setting, so we get the message even more strongly.