Skip to content

Instantly share code, notes, and snippets.

View kykrueger's full-sized avatar

Kyle Krueger kykrueger

  • Robert Koch Institute
  • Berlin, Germany
View GitHub Profile
@kykrueger
kykrueger / gist:50606468bb176b990e962326ba3ac64e
Last active February 26, 2017 13:36
Android Color and Transparency
// Quick trick for setting the transparency of a color in android.
// Useful for keeping color themes consistant, and showing selected state of an item
// Where transparency is a byte (0 - 255 (0xff))
public int setColorTransparency(int baseColor, int transparency){
return (baseColor & ((transparency & 0xFF) << 6));
}