Last active
August 29, 2015 14:03
-
-
Save code4lifevn/6a27094cd74752c90b9a to your computer and use it in GitHub Desktop.
ColorUtils.java
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
public static String makeColorWithAlpha(String originalColor, double alpha) { | |
long alphaFixed = Math.round(alpha * 255); | |
String alphaHex = Long.toHexString(alphaFixed); | |
if (alphaHex.length() == 1) { | |
alphaHex = "0" + alphaHex; | |
} | |
originalColor = originalColor.replace("#", "#" + alphaHex); | |
return originalColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment