Window screenshots on a Mac come with a big soft shadow. Great for a presentation, annoying for documentation.
Two flags fix it. -w allows only window selection, and -o leaves out the window shadow.
screencapture -o -w ~/Desktop/settings.png
Your pointer turns into a camera. Click the window and the file lands where you said. Add -c instead of a filename if you want it on the clipboard.
screencapture -o -w -c
The man page is clear that -o only does something in window capture mode. If you use it with a rectangle or a full screen capture, nothing changes.
The caveat is that you now have a window with hard edges on a white page. That looks fine on a dark blog theme and a bit lost on a white one. Try both.
If you write documentation or blog posts about macOS, this saves a round of cropping and editing. The system shortcut can do the same with the Option key, so use whichever you remember.
Further reading: screencapture.1 man page, On this site: screencapture -T 5 takes a screenshot after a delay, On this site: sips -Z shrinks photos from the terminal