Galera, I have this code where it generates a kind of link theme and I'd like to apply that code to it for that the text contrasts with bg, How can I do this because my bg and the color of the text are random?
But I wanted the code to give me several contrast cores, not just one.
Code to leave text in contrast
var rgb = $('#content').css('backgroundColor');
var colors = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var brightness = 1;
var r = colors[1];
var g = colors[2];
var b = colors[3];
var ir = Math.floor((255-r)*brightness);
var ig = Math.floor((255-g)*brightness);
var ib = Math.floor((255-b)*brightness);
$('#content').css('color', 'rgb('+ir+','+ig+','+ib+')');