Skip to content

Instantly share code, notes, and snippets.

@omatt
Created September 22, 2013 14:25
Show Gist options
  • Save omatt/6660399 to your computer and use it in GitHub Desktop.
Save omatt/6660399 to your computer and use it in GitHub Desktop.
Set colors in Java using hex color codes. Generate hex color codes in here - http://hexcolorgenerator.com/
Color colorA = new Color(0xFF0096); // Use the hex number syntax
Color bColor = Color.decode("0xFF0096"); // or with the use of decode
object.setColor(Color.white);
setBackground(Color.white);
/** Alternatively using hex color codes to expand the color library **/
object.setColor(new Color(0xFF0096));
object.setColor(Color.decode("0xFF0096"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment