Skip to content

Instantly share code, notes, and snippets.

@shankarsridhar
Last active February 5, 2020 04:21
Show Gist options
  • Save shankarsridhar/c53840c73bdbe3930c3214766ba31bb7 to your computer and use it in GitHub Desktop.
Save shankarsridhar/c53840c73bdbe3930c3214766ba31bb7 to your computer and use it in GitHub Desktop.
// adds a bund of div boxes with colors specified to body for preview purposes
(function showColors() {
var colors = [
'#0091ca',
'#087889',
'#827be9',
'#acb9c2',
'#e55800',
'#cc167e',
'#65c3e8',
'#0e95a0',
'#b2b0fa',
'#5c6f7c',
'#f6a16c',
'#ff1b90',
'#0073b1',
'#68c5cd',
'#665ed0',
'#7a8b98',
'#b74700',
'#ff91cf'
];
var boxContainer = document.createElement('div');
boxContainer.style.position = 'fixed';
boxContainer.style.zIndex = 9999;
boxContainer.style.top = 0;
boxContainer.style.height = '300px';
colors.forEach(color => {
var box = document.createElement('div');
box.style.width = '128px';
box.style.height = '32px';
box.style.display = 'inline-block';
box.style.backgroundColor = color;
box.innerHTML = color;
boxContainer.appendChild(box);
});
document.body.appendChild(boxContainer);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment