setting sprite with new color produces cmyk colors only

I’m trying to set the rgb color for a GameObject like so:

var tempObj = Instantiate(PlatformObj, new Vector2(1,1, Quaternion.identity);
object.GetComponent<SpriteRenderer>().color = new Color(255, 255, 45, 1);

This will result in having the object completely white. When I change the color using the color picker inside the editor it will only switch between CMYK colors.

But if I set the color of the GameObject like this it works perfect.

object.GetComponent<SpriteRenderer>().color = Color.green;

This should result in a red-ish color but instead it’s yellow.

Color takes a float value from 0-1. In the pic, if you click on the RGB 0-255 and swap it to RGB 0-1, you can see the values you need to use.

1 Like