rgbValues[2]);

            // Lighter colors don't show hex values well against background.
            elements[i].classList = [];
            elements[i].innerHTML = values;
        }

        // stolen: http://stackoverflow.com/a/5624139/1686511
        function componentToHex(c) {
            var hex = parseInt(c, 10).toString(16);
            return hex.length == 1 ? "0" + hex : hex;
        }

        function rgbToHex(r, g, b) {
            return "#" + componentToHex(r) + componentToHex(g) + compon