JSFiddle - React, Tailwind, and code Playground
HTML
<span id="color-map"></span>
CSS
body {
background: red;
}
JavaScript
var element = document.getElementsByTagName("body")[0];
var style = window.getComputedStyle(element);
document.getElementById('color-map').innerHTML = rgbsToHex(style.backgroundColor);
function rgbsToHex(str) {
var hex = "#";
var matches = str.match(/rgb\((\d+),\s(\d+),\s(\d+)\)/);
hex += Number(matches[1]).toString(16);
hex += Number(matches[2]).toString(16);
hex += Number(matches[3]).toString(16);
return hex;
}