Returns the desaturated version of the Color. 0 represents no desaturation and 1 represents full desaturation.
None
ToStandardHex()
string
Returns a hexadecimal sRGB representation of this color, in the format "#RRGGBBAA". Channel values outside the normal 0-1 range will be clamped, and some precision may be lost.
None
ToLinearHex()
string
Returns a hexadecimal linear RGB representation of this color, in the format "#RRGGBBAA". Channel values outside the normal 0-1 range will be clamped, and some precision may be lost.
Creates a Color from the given sRGB hexadecimal string. Supported formats include "#RGB", "#RGBA", "#RRGGBB", and "#RRGGBBAA", with or without the leading "#".
Creates a Color from the given linear RGB hexadecimal string. Supported formats include "#RGB", "#RGBA", "#RRGGBB", and "#RRGGBBAA", with or without the leading "#".
This utility function calculates a color useful for a health bar.
functionGetHitPointsColor(currentHitPoints,maxHitPoints)-- 3 point gradient color, from red to yellow then greenlocalpercent=1ifmaxHitPoints>0thenpercent=currentHitPoints/maxHitPointspercent=CoreMath.Clamp(percent,0,1)endlocalcifpercent<0.5thenc=Color.Lerp(Color.RED,Color.YELLOW,percent*2)elsec=Color.Lerp(Color.YELLOW,Color.GREEN,percent*2-1)endreturncend