Something like this will give you some idea :) have fun!
JavaScript:
<script>
function setMyFavorite(){
var elem = document.getElementById("circle");
var theColor = window.getComputedStyle(elem, null).getPropertyValue("background-color");
var hex = rgb2hex(theColor);
if(hex =="#555555"){
elem.style.backgroundColor = "#ffffff";
}
else if(hex =="#ffffff"){
elem.style.backgroundColor = "#555555";
}
function rgb2hex(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
</script>
CSS
background-color:
border-radius: 50%;
border-color:
border-style: solid;
source
share