This can be used in xterm and st, but to use it in st you'll need the xresources patch.
Clone this repository, and inside the Xresources folder you should see both .Xresources-light
and .Xresources-dark
versions, make sure to copy the one you're going to use and rename it just to .Xresources
.