Neat-o, , 3, , 255, , hexa , hexa, reasamble # . - , , .
:
<script language="JavaScript" type="text/JavaScript">
function bla(){
var b = document.getElementsByTagName('body')[0];
var bg = b.style.backgroundColor;
alert('the present background is '+b.style.backgroundColor)
alert('the present background will be change into inversed RGB color')
var oldCol = bg.split('(')[1].split(')')[0].split(',');
var newCol = new Array()
for(var i=0;i<oldCol.length;i++){
newCol[i] = 255-Number(oldCol[i]);
}
b.style.backgroundColor = 'rgb('+newCol[0]+','+newCol[1]+','+newCol[2]+')';
alert('the new background is '+b.style.backgroundColor)
}
onload=bla
</script>
EDIT: Er, I assume you want to do this programmatically, so that you can change the color without changing the state “on top” as well? Otherwise, yes, the other 2 answers said.
source
share