PortraitImagePlugin Uses Flawed Color Values

by Jule 45 views
PortraitImagePlugin Uses Flawed Color Values

Bug Report: PortraitImagePlugin sets portrait color with new Color(255, 255, 255, 255), but Unity’s Color expects normalized floats (0 - 1). This delivers overbright white - like painting a sunset with neon chalkboard chalk. The fix is simple but overlooked: Color.white or new Color(1f, 1f, 1f, 1f) - no 255s allowed. Here’s the immediate impact: when called in {{Image(Sprites/SomePortrait)}}, the image blinks white. But worse: HidePortrait() uses new Color(0, 0, 0, 0) - a happy coincidence, since black works in this flawed pipeline, but masks the real issue. Here’s the hidden detail: most UI color systems assume 0 - 1 float range, not 0 - 255 pixel values. That’s a critical mismatch. Users assume black is black; the plugin treats it as white. Major safety risk in design: silent visual glitches break immersion. Do test with Color.white in assets and avoid raw 0 - 255 params. The Elephant in the Room? Color isn’t universal - context matters. Are you sure you want white to mean ‘invisible’?

The Bottom Line: Color isn’t just technical - it’s perception. And this bug turns clarity into confusion. When did ‘overbright’ become default? Keep your palette honest. Would you trust a portrait that glares back incorrectly? Only if it’s intentional. Don’t let a typo make your visuals feel off. Choose color wisely - your audience sees more than you think.