Skip to main content

ColorGradeUtils

Helps with color grades, which is the concept where the darkness of the color goes from 0 to 100, with a grade of 100 being white, and a grade of 0 being black.

Grades ensure a human-readable contrast value which means a grade contrast of 70 will always meet accessibility standards.

Functions

addGrade

ColorGradeUtils.addGrade(
gradenumber,
differencenumber
) → Color3

Adds to the grade and picks the direction to ensure the best amount of contrast. May consider using ColorGradeUtils.ensureGradeContrast for a more background aware contrast picker.

ensureGradeContrast

ColorGradeUtils.ensureGradeContrast(
colorColor3,
backingColor3,
amountnumber--

Between 0 and 100

) → Color3

Ensures the given contrast between the color and the backing, with an adjustment to saturation to keep the UI loking good

getGrade

ColorGradeUtils.getGrade(colorColor3) → number

Gets the grade for a given color

getGradedColor

ColorGradeUtils.getGradedColor(
baseColorColor3,
colorGradenumber,--

0 to 100

vividnessnumber | nil
) → Color3

Converts a color into a graded version of that color.

Show raw api
{
    "functions": [
        {
            "name": "addGrade",
            "desc": "Adds to the grade and picks the direction to ensure the best amount of contrast.\nMay consider using [ColorGradeUtils.ensureGradeContrast] for a more background\naware contrast picker.",
            "params": [
                {
                    "name": "grade",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "difference",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 27,
                "path": "src/colorpalette/src/Shared/Grade/ColorGradeUtils.lua"
            }
        },
        {
            "name": "ensureGradeContrast",
            "desc": "Ensures the given contrast between the color and the backing, with\nan adjustment to saturation to keep the UI loking good",
            "params": [
                {
                    "name": "color",
                    "desc": "",
                    "lua_type": "Color3"
                },
                {
                    "name": "backing",
                    "desc": "",
                    "lua_type": "Color3"
                },
                {
                    "name": "amount",
                    "desc": "Between 0 and 100",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 59,
                "path": "src/colorpalette/src/Shared/Grade/ColorGradeUtils.lua"
            }
        },
        {
            "name": "getGrade",
            "desc": "Gets the grade for a given color",
            "params": [
                {
                    "name": "color",
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "src/colorpalette/src/Shared/Grade/ColorGradeUtils.lua"
            }
        },
        {
            "name": "getGradedColor",
            "desc": "Converts a color into a graded version of that color.",
            "params": [
                {
                    "name": "baseColor",
                    "desc": "",
                    "lua_type": "Color3"
                },
                {
                    "name": "colorGrade",
                    "desc": "0 to 100",
                    "lua_type": "number"
                },
                {
                    "name": "vividness",
                    "desc": "",
                    "lua_type": "number | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 114,
                "path": "src/colorpalette/src/Shared/Grade/ColorGradeUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "ColorGradeUtils",
    "desc": "Helps with color grades, which is the concept where the darkness of the color\ngoes from 0 to 100, with a grade of 100 being white, and a grade of 0 being\nblack.\n\nGrades ensure a human-readable contrast value which means a grade contrast\nof 70 will always meet accessibility standards.",
    "source": {
        "line": 11,
        "path": "src/colorpalette/src/Shared/Grade/ColorGradeUtils.lua"
    }
}