Colors in inspector showing up wrong in game and weird color swatches bug

Hey, I encountered a pretty weird bug while working with averaging colors. The color rgb values clearly show that the color should appear primarily blue, which is also reflected by the hex code. But ingame, the dark green you can see in the top right is showing up and i have no idea why. Does anyone have experience with this kind of behaviour and knows how to solve it?

The Material of the sprite is using a ShaderGraph, which shouldn’t change the color though, see the screenshot below. The assigned color for ContentsColor also is the wrong color (the dark green). Also, the color I’d expect to come out is the blue the hex code represents.

Also, i wouldn’t expect the main question I’m interested in (“Why are rgb values and hex code showing a blue color, but the preview in the top right a green one?”) to depend on the context I’m working in, but i might be fundamentally misunderstanding something about Unity’s color system.


Can you provide more info on your use case? This might be an instance where you need to convert the colors.

Depends on if it’s UI, objects, or shaders, etc.

As above, you don’t provide any context on what this is being used on. If it’s a SpriteRenderer (you tagged this as 2D-graphics) then that’s not an absolute color, it’s a color “tint” so it depends on the color of the original texture.

Your original sprite/texture should be white to give you exactly what you selected here.

Yeah, sorry. I didn’t include context because my question was mainly focused on the color panel. Why are hex code and preview (top right) showing different colors? I’ve edited the main post to include some additional informations :slight_smile:

the color switcher is sometimes wacky and might not reflect what is actually happening, instead, use debug logs and look at the actual color ingame, take a printscreen and open it in photoshop

these are just some tips for you to debug this

now if its all good it might just be a case of color swatcher is sometimes buggy when used as an interface, but the code underneath is solid

1 Like

So the only reason I’m here is because you’ve tagged this as 2D-Graphics but it seems you’re just asking about the general color dialog.

I’ll remove the 2D-Graphics tag. Please only use the tags that relate directly to the question.

Thanks.