Created
February 15, 2015 18:37
-
-
Save hjerpbakk/3467666fb70140c01479 to your computer and use it in GitHub Desktop.
Get the color given a ratio between a start and end color. From: http://www.hjerpbakk.com/blog/2015/2/15/gradient-colors-on-ios
This file contains hidden or 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
public static UIColor ColorForRatio(float[] startColor, float[] endColor, float colorRatio) { | |
return UIColor.FromRGB(startColor[0] + (endColor[0] - startColor[0]) * colorRatio, | |
startColor[1] + (endColor[1] - startColor[1]) * colorRatio, | |
startColor[2] + (endColor[2] - startColor[2]) * colorRatio); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment