VulCode

Unity colour

Convert hex to Color and Color32 with a ready line of C#.

Category
SCP:SL, Steam and Unity
Price
free

The tool starts in your browser.

Everything is calculated in your browser. Nothing you type is sent to our server.

How to use it in three steps

The tool as a schematic with this page's example. Each step's number stands where you take it: in the fields, at the result or outside the tool.

Unity colour
What you enter
#414df2, alpha 1
  1. Pick a colour or type a hex code.

  2. Set the alpha.

What you get
new Color(0.2549f, 0.302f, 0.949f, 1f) new Color32(65, 77, 242, 255)
  1. Copy the C# line with Color or Color32.

#414df2 in Unity code

The same colour in two Unity types, computed by the tool's function: Color keeps channels from 0 to 1, Color32 from 0 to 255.

You enter

Hex
#414df2
Alpha
1

Channels from 0 to 255

Color32
new Color32(65, 77, 242, 255)
What the tool does

Each pair of hex digits is one channel: 41, 4d, f2. Alpha 1 is 255.

Channels from 0 to 1

Color
new Color(0.2549f, 0.302f, 0.949f, 1f)
What the tool does

Each channel divided by 255, rounded to four places, trailing zeros dropped.

C#

  • new Color(0.2549f, 0.302f, 0.949f, 1f)
  • new Color32(65, 77, 242, 255)

Questions