Additional Color3 Accessibility APIs

Hey so this is LITERALLY being written right after Roblox just announced the new Color3 contrast & luminance methods, but as someone with a mild red-green color deficiency, I was thinking there could now be a genuine case for supporting color vision deficiencies directly through Color3.

The new methods are great for checking contrast and readability, but there’s still the issue of colors that look completely different to one person being practically indistinguishable to someone else.

π’œπ“ˆ 𝒢 π‘…π‘œπ’·π“π‘œπ“ π’Ήπ‘’π“‹π‘’π“π‘œπ“…π‘’π“‡[1], it’s currently rather annoying to actually test for this without relying on external tools or implementing the color transformations yourself.


Proposed Methods

Color3:SimulateColorVisionDeficiency()

Color3:SimulateColorVisionDeficiency(
    visionType: Enum.ColorVisionDeficiency,
    severity: number?
): Color3

[2]

Pretty self-explanatory (I hope), this would return a Color3 approximating how the original color would appear to someone with a particular color vision deficiency.

Ideally, it’d support the different types, I might be naming these wrong but

  • Protanopia
  • Deuteranopia
  • Tritanopia
  • Achromatopsia
  • etc

Color3:GetPerceptualDifference()

Color3:GetPerceptualDifference(
    other: Color3,
    visionType: Enum.ColorVisionDeficiency?
): number

This one would be for comparing two colors based on how distinguishable they actually are, optionally accounting for a particular color vision deficiency.

I’m not entirely sure what the best measurement would be here, but ideally the returned number would follow some sort of documented perceptual difference metric, so developers could establish their own thresholds for how distinguishable two colors should be.


Having some sort of perceptual difference calculation would make it easier to identify potentially problematic color combinations without having to visually inspect every single one. Still, having these capabilities built into the engine would make testing for these issues considerably easier, especially now that Color3 is already getting accessibility-related functionality.

I just think it’d be a pretty natural extension of what was announced today.


  1. sorry just had to add the fancy text β†©οΈŽ

  2. I included severity as an optional value between 0 and 1, although please don’t treat that as being necessary specifically. It just seems like it could make sense for the logic being done, especially if there were some sort of UI slider hooked up to it. β†©οΈŽ

Also, why not just add studio viewport window filter options in the viewport options tab?
This will help test the general look of the game, and it will act as the last priority post-processing effect, ensuring your color grading options are applied first.