This may be a rather lengthy explanation, so bear with me. I am a little foggy on screen colour theory, so apologies if I'm asking stupid questions... here goes...
I wish to be able to write a function like so..
function fadeColour($base_colour, $percent) {
}
Then I can provide the $base_colour in standard hex (eg. #FF0000) and the $percent to fade.
So the script would work out the $percent alpha of the $base_colour (ie. mix with white) So if the $base_colour was #FF0000 and the $percent was 5 the result would be #DB201C
I've tried this in several ways, the closest I cam was to the split the hex into it's rgb components then use hexdec() to convert each colour to a decimal, subtract the $percent then re-hex it. However this just changed the colour through the spectrum rather than giving a alpha/transparency fade effect.
This is driving me mad, could someone please point me in the right direction or give me some solution? Thank you!