Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(function randomSkinTone() {
const fitzPatrickTones = [
'#ffe2cc',
'#fadbaf',
'#e5bd95',
'#bf8b60',
'#98562e',
'#673929',
];
const tone = _.sample(fitzPatrickTones);
const element = document.createElement('style');
element.innerHTML = `.random-skin-tone-fill { fill: ${tone} !important; }`;
const header = document.getElementsByTagName('HEAD')[0];
header.appendChild(element);
})();
@philwolstenholme

This comment has been minimized.

Copy link
Owner Author

@philwolstenholme philwolstenholme commented Jun 9, 2020

@philwolstenholme

This comment has been minimized.

Copy link
Owner Author

@philwolstenholme philwolstenholme commented Jun 9, 2020

(Note the Lodash dependency on line #11, but that could be swapped with any method of randomly picking an item from an array)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment