I am trying to make a function that checks the bg element and changes its bg to the given alpha channel. The function has the following form:
$.fn.bgalpha = function(alpha) {
var bg = $(this).css('background-color');
}
But: chrome returns bg as rgb when normal color is set, and as rgba with zero when there is no bg, i.e. 8 always returns hex, ie9 returns "transparent" when there is no bg and rgb, when there is bg, etc. So many different cases.
What I want to do is → get r, g, b from the bg color of the object, add the 'a' channel to it and set the bg element to rgba with all the values. But from a simple thing, making it becomes complicated and complicated when we talk about cross-viewing.
Do you have any ideas on how to work with these colors as a "single-user" way? In different cases, I get the values "none", "transparent", "rgba", "rgb" or "hex" as the initial value of bg
OPOPO source
share