To stop ‘white flash’ on your dark background, do this
webView.opaque = false
This doesn’t really solve background colour issue, but at least it stops ‘white flash’ you are experiencing.
Apparently there seem to be no way to change background colour of WKWebView before loading HTML on it.
Swift 4
webView.isOpaque = false