Skip to content

Instantly share code, notes, and snippets.

@neilkimmett
Created September 27, 2018 19:23
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 neilkimmett/d860c9a6d4564abdb05a0d97202ada3f to your computer and use it in GitHub Desktop.
Save neilkimmett/d860c9a6d4564abdb05a0d97202ada3f to your computer and use it in GitHub Desktop.
const colors = result
.get('props')
.map(prop => {
const { r, g, b, a } = tinycolor(prop.get('value')).toRgb();;
return ` @objc static let ${prop.get('name')} = #colorLiteral(red: ${parseFloat(r)/255.0}, green: ${parseFloat(g)/255.0}, blue: ${parseFloat(b)/255.0}, alpha: ${parseFloat(a)})`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment