There's literally no possible way for shades of grey to exist when there are people who decide what is good and bad. You can't be tricked into committing an evil act, there are too many safe guards in place (the gods will warn you) and even if you did, you got an evil result out of a good act. It's hard to think of this in the real world, but in D&D your interpretation of right and wrong don't matter when it's the gods of the setting who decide what is right and wrong. You might interpret them as evil in the real world, but in the context of the game world you're wrong for interpreting them as evil. They aren't jerks because they aren't looking down on us, WE are the ones that are cosmologically insignificant in the D&D universe. Now in this case the DM can do whatever they want...BUT that is the DM adding to the setting, not the setting being built for shades of grey to be there.
That's honestly dependent on which version of D&D you're playing. The definitions of alignment do tend to vary wildly between editions as they clarify them or change them so that can attempt to get players to use the alignments as base personalities and motivations instead of hard-coded rules.
I don't know who said it first, and I'd love to know, but one of the best things I've heard as advice to writers is "Everyone is the hero of their own story, the only people or creatures who are evil are actually just legitimately insane because only the legitimately insane set out to 'do evil'."
Also, the interpretation of "good and evil" does actually apply when you bring the nature of Lawful characters into it. Lawful characters are characters who follow the law, regardless of what it is, or even if they agree with it. A Lawful Good Paladin would actually be very much in trouble in a town where it's the law to eat only of human flesh. The "Good And Evil" stuff in D&D tends to get muddied by the extra "Lawful, Chaotic, Neutral" stuff the game adds on top of the base alignments.
Which is, again, one of the reasons I typically throw alignment out the window in D&D, because you can argue about it for days and months and years, and never convince people of your way of thinking. The fact that there can be so many different viewpoints on alignment, how it works, and what it even means, is proof positive that D&D itself is shades of grey and not black and white. Oh, black and white can exist. But, the vast majority of the worlds that are even in the books or settings play with shades of grey more than black and white. Except, of course, if we're talking about the Gods themselves. They tend to be the only real black and white in all the game worlds... and even that is somewhat debatable depending on version.
Also, why would the Gods warn if you're going to commit an evil act by accident? I guess if your DM is nice, they would have your God do so... But, in most any setting of D&D, the Gods are fairly "hands off" and don't usually talk to you at all unless they want something specific from you. Which means... you kind of have to be a special snowflake of some kind to even get their attention enough to warrant their speaking to you in the first place. Otherwise, the most you might get is the realization that your powers don't actually work because you've offended the God in some way... Or maybe some demons or angels show up to murder you if you've especially strayed.