Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Array.from(document.querySelectorAll('.theme-color')).forEach(function(el) {
let elem = document.getElementsByClassName(el.classList[0])[0];
let background = getStyle('background-color', elem);
let table = document.createElement('table');
table.innerHTML = `
<table class="w-100">
<tbody><tr>
<td class="text-muted">HEX:</td>
<td class="font-weight-bold">${rgbToHex(background)}</td>
</tr>
<tr>
<td class="text-muted">RGB:</td>
<td class="font-weight-bold">${background}</td>
</tr>
</tbody></table>
`;
el.parentNode.appendChild(table);
});
Array.from(document.querySelectorAll('.theme-color')).forEach(function(el) {
const elem = document.getElementsByClassName(el.classList[0])[0];
const background = getStyle('background-color', elem);
const table = document.createElement('table');
table.innerHTML = `
<table class="w-100">
<tbody><tr>
<td class="text-muted">HEX:</td>
<td class="font-weight-bold">${rgbToHex(background)}</td>
</tr>
<tr>
<td class="text-muted">RGB:</td>
<td class="font-weight-bold">${background}</td>
</tr>
</tbody></table>
`;
el.parentNode.appendChild(table);
});
render() {
return (
<table>
<tbody>
<tr>
<td>HEX:</td>
<td>{ rgbToHex(this.state.bgColor) }</td>
</tr>
<tr>
<td>RGB:</td>
<td>{ this.state.bgColor }</td>
</tr>
</tbody>
</table>
)
}
}