Skip to content

Instantly share code, notes, and snippets.

@marianomike
Created December 30, 2016 00:18
Show Gist options
  • Save marianomike/71442dca57a9dbb95ccfc4a02f83f7f0 to your computer and use it in GitHub Desktop.
Save marianomike/71442dca57a9dbb95ccfc4a02f83f7f0 to your computer and use it in GitHub Desktop.
function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
function colorFromString(value) {
var immutable = MSImmutableColor.colorWithSVGString_(value);
return MSColor.alloc().initWithImmutableObject_(immutable);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment