JSFiddle - React, Tailwind, and code Playground

HTML

<select>
  <option class="yellow" value="1">Yellow</option>
  <option class="red" value="2">Red</option>
  <option class="green" value="3">Green</option>
  <option class="blue" value="3">Blue</option>
  <option class="grey" value="3">Grey</option>
  <option class="Orange" value="3">Orange</option>
</select>

JavaScript

$("select option").each(function(){
    var color = $(this).attr("class");
    
    $(this).css("background", color);
});