Skip to main content

system.kanoa.utilities.getContrastingColor(colorString)

Takes a string in either the form of RGB hex digits with hash sign (i.e. #FFFFFF') or a CSS custom variable (i.e '--KcBlue-60') to compute a complementary contrasting color such as for fonts against a background


Parameters

colorString String: RGB hex digits or a Kanoa CSS custom variable


Returns

hexColor String


Example

print system.kanoa.utilities.getContrastingColor('#FF0000')
>>>
#FFFFFF
print system.kanoa.utilities.getContrastingColor('--kcBlue-10')
>>>
#000000