I want to get all background and color properties values of all CSS declarations.
For example:
body {
background: #fff;
}
.aaa {
background: #dedede;
color: #000
}
.text {
color: #333;
padding: 10px
}
I want to get an output like this and the values of these properties need to be stored in an array.
body {
background: #fff;
}
.aaa {
background: #dedede;
color: #000
}
.text {
color: #333;
}
I tried to do this using jQuery. I can get the background property value of one specific class like .aaa
or .text
. How do I get the values of all classes?
$('#btn-invert').on('click', function() {
var color = $("body").css("background");
// var test = invertColor("#00a3fe");
console.log(color);
});