Skip to content

Instantly share code, notes, and snippets.

@philwolstenholme
Last active June 9, 2020 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philwolstenholme/718a13a5a6e9267edf88c6bc8a98f5ef to your computer and use it in GitHub Desktop.
Save philwolstenholme/718a13a5a6e9267edf88c6bc8a98f5ef to your computer and use it in GitHub Desktop.
(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
Copy link
Author

@philwolstenholme
Copy link
Author

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