recalculate color from [0,255] to [0,1]

hi folks!

is there a tool or a simple way to get the recalculate the color vektor from (255,255,255) to (1,1,1)?

thanx!

You could simply use:

Color myColor = new Color32(50, 220, 255, 255);

or

Color32 myColor = new Color(0.2f, 0.3f, 0.4f, 1f);

http://docs.unity3d.com/Documentation/ScriptReference/Color32-ctor.html

Cheers

Use a function like this:

function ConvertColor (r : int, g : int, b : int) : Color {
    return Color(r/255.0, g/255.0, b/255.0);
}

function ConvertColor (r : int, g : int, b : int, a : int) : Color {
    return Color(r/255.0, g/255.0, b/255.0, a/255.0);
}

Then you can do:

renderer.material.color = ConvertColor(128, 50, 200);
// or
renderer.material.color = ConvertColor(255, 0, 0, 25);

This site will do it for you http://www.easyrgb.com/index.php?X=CALC

Fill in your existing colour values, hit start and then it'll load a page with all the conversions, you'll want to look at the RGB 0-1 list

Cheers