How to know if a color is a closer to black or to white

As the title says. I want to figure out if a given color is closer to black or to white. Any help is appreciated!

check

function whiteOrBlack(color3)
    local h,s,v = color3:ToHSV ( )
    if v >= 0.5 then
        return brickColor.new('white')-- the color is white
    else
        return brickColor.new('black')-- the color is black
    end
end
3 Likes