Nobody said anything about black or white. Try googling for png color problems and you’ll find thousands of questions, in all kinds of tools and browsers. The css color and the png color need to match exactly. Just a slight difference will look off if placed next to each other. The risk of css and png rendering two same hex-codes differently increase when putting semi-supported hdr extensions in the mix.
For this particular use case, yes, transparency is more suitable than trying to match.
For this particular use case, yes, transparency is more suitable than trying to match.