Transform black into any given color with CSS filters

How to transform black into any given color using only CSS filters:

My question is: given a target RGB color, what is the formula to recolor black (#000) into that color using only CSS filters?

For an answer to be accepted, it would need to provide a function (in any language) that would accept the target color as an argument and return the corresponding CSS filter string.

There are only a few number of SO questions which are worth reading and this one is for sure one of them, I really enjoyed reading the thought process from the author’s point of view and how complex this feature it is even though it seems so simple and something that should be readily available.

← Back to home