JSFiddle - React, Tailwind, and code Playground

HTML

<div class="a"></div>
<div class="d"></div>
<div class="c"></div>
<div class="d"></div>

CSS

div {
  width: 100px;
 height:  100px;    
}
.d {
  background-color: red;   
}
.a {
  background-color: blue;   
}
.c {
  background-color: green;   
}

JavaScript

var arr = [];

$('*').each(function (i, ele) {
   // is red => save
   if($(ele).css('backgroundColor') == ('rgb(0, 0, 255)')) arr.push(ele);
});

console.log(arr);