JSFiddle - React, Tailwind, and code Playground
HTML
<div class="d1"></div >
<div class="d2"></div >
<div class="d3"></div >
<div class="d4"></div >
<div class="d5"></div >
CSS
div {
width: 50px;
height: 50px;
background: red;
display: inline-block;
}
.d2, .d3, .d5 {
background-color: #eb2c33
}
.jcbg {
background-color: green;
}
JavaScript
function hex2rgb(hex) {
return ['0x' + hex[1] + hex[2] | 0, '0x' + hex[3] + hex[4] | 0, '0x' + hex[5] + hex[6] | 0];
}
$(document).ready(function (e) {
// Color to change
var targetHex = hex2rgb('#eb2c33');
$('body *').each(function(index) {
var rgbg = $(this).css('background-color');
if(rgbg == 'rgb('+targetHex[0]+', '+targetHex[1]+', '+targetHex[2]+')'){
$(this).addClass('jcbg');
}
});
});