JSFiddle - React, Tailwind, and code Playground

JavaScript

/**
 * ******************************************************************************************
 * Global variables
 * ******************************************************************************************
 */

// Select the generated colors block
const $generatedColors = document.getElementById("generatedColors");

// Make an array from the generated colors and input colors, so we can manipulate them
let generatedColorBlocks = Array.from($generatedColors.children);
const inputColorBlocks = Array.from(
  document.getElementById("inputColors").children
);