Skip to content

Instantly share code, notes, and snippets.

@igalata
Created July 26, 2017 19:51
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 igalata/22916f68888dc2e2c7f37f7141d1fb31 to your computer and use it in GitHub Desktop.
Save igalata/22916f68888dc2e2c7f37f7141d1fb31 to your computer and use it in GitHub Desktop.
fun Int.rgba(context: Context) = ContextCompat.getColor(context, this).rgba()
fun Int.rgba(): Vec4 = Vec4(
Color.red(this).toFloat() / 256f,
Color.green(this).toFloat() / 256f,
Color.blue(this).toFloat() / 256f,
Color.alpha(this).toFloat() / 256f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment