Skip to content

Instantly share code, notes, and snippets.

@beardordie
Last active January 16, 2019 23:06
Show Gist options
  • Save beardordie/f2b005a844329734e6b944041ec1ce1c to your computer and use it in GitHub Desktop.
Save beardordie/f2b005a844329734e6b944041ec1ce1c to your computer and use it in GitHub Desktop.
Unity - Code Snippet to convert a Color value to an RGB hex value
// this is not a full class, just a code snippet showing the relevant method to convert a Color object
// to an RGB hex value so it can be used in a text field
public Color playerColor;
public Text playerTextField;
playerTextField.text = "<color=#" + ColorUtility.ToHtmlStringRGB(playerColor) + ">PLAYER</color>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment