I tried ‘Color.yellow’ and it worked fine which is great.
However, as a test to see if i could replicate the colour using its RGBA values:
Color(1, 235/255, 4/255, 1); //As shown in the documentation above
It gives me the colour red instead.
Although this isnt a problem as i can simply use ‘Color.yellow’ to achieve yellow, it is problem as if it had of worked, i could have used a similar approach to display orange and purple.
Wow, that’s some stupid code in our docs - that code is trying to divide two integers, which for the G value is equalling zero. You should use floating point values for this:
so basically color is not the same as inspector. instead 255 is equal to one and 128 is equal to 0.5 and so on. is their a way to convert the inspector values into the correct numbers, if not i could always make a little calculator tool
Well, no, the inspector is an abstract representation of the color and doesn’t use any particular numbers; the OS X color picker for example can use RGB, HSB, CMYK, or grayscale. Even the Unity color picker uses both RGB and HSV.
You can use Color32, which uses 1 byte each for RGB, so you get 0-255, rather than using floats like Color does (this also means Color32 uses 4X less memory than Color).
actually i now remember something about this from school, any way i thought i would quickly do a sort of color chart for people interested, i may or may not make a tool to do this to be honest i probably wont use it much anyway.
so here is what each number represents to the inspectors color, so get the color you want in that and use this to get the color,