JSFiddle - React, Tailwind, and code Playground

HTML

<body style='color:red;'>
    <div id='bluediv'></div>
    <pre id='output' style='color:#007700'></pre>
</body>

CSS

#bluediv {
    background-color:blue;
}

JavaScript

function getAllColors() {
		// regex via http://stackoverflow.com/a/7543829/149636
		var rgbRegex = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/;

		var allColors = [];

		var elems = document.getElementsByTagName('*');
		var total = elems.length;

		var x,y,elemStyles,styleName,styleValue,rgbVal;

		for(x = 0; x < total; x++) {
			elemStyles = window.getComputedStyle(elems[x]);

			for(y = 0; y < elemStyles.length; y++) {
				styleName = elemStyles[y];
				styleValue = elemStyles[styleName];
				if(!styleValue) {
					continue;
				}

                // convert to string to avoid match exceptions
				styleValue += "";
                
				rgbVal = styleValue.match(rgbRegex);
				if(!rgbVal) { // property does not contain a color
					continue;
				}

				if(allColors.indexOf(rgbVal.input) == -1) { // avoid duplicate entries
					allColors.push(rgbVal.input);
				}

			}

		}

		return allColors;
	}

document.getElementById('output').innerHTML = getAllColors().join('\n');