Contrasting Colors function

function GetContrastColor(bgColor)
	local brightness = (bgColor.R * 299 + bgColor.G * 587 + bgColor.B * 114) / 1000
	if brightness > 0.5 then
		return Color3.new(0, 0, 0) -- black for light backgrounds
	else
		return Color3.new(1, 1, 1) -- white for dark backgrounds
	end
end

Basically, Returns a color. Imputing a color3, will return the color properly.
(CORRECTED A MISTAKE WHEN POSTING.

3 Likes

You should give examples of how people can use this and what it actually does.

1 Like