Created
June 25, 2018 16:52
-
-
Save cyrilmottier/1f828ef09092efaec553cc0e199334a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val colorCount = RAINBOW_COLORS.size | |
val colors = IntArray(colorCount * 2) | |
val stops = FloatArray(colorCount * 2) | |
for (i in 0 until colorCount) { | |
colors[i * 2] = ContextCompat.getColor(context, RAINBOW_COLORS[i]) | |
colors[i * 2 + 1] = colors[i * 2] | |
stops[i * 2] = i / colorCount.toFloat() | |
stops[i * 2 + 1] = (i + 1) / colorCount.toFloat() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment