lessColor Operation Functions


Syntax

  • contrast(<reference-color>, <output-for-light-refcolor>, <output-for-dark-refcolor>, <threshold>)
  • lighten(<reference-color>, <amount>, <method>)
  • darken(<reference-color>, <amount>, <method>)

Parameters

ParameterDetails
reference-colorThe color based on which the color operation should be performed.
output-for-light-ref-colorThe color value that should be output when reference color is a dark color. This is optional and default value is white.
output-for-dark-ref-colorThe color value that should be output when reference color is a light color. This is optional and default value is black.
thresholdThis is a percentage value which defines when the reference color is considered as a dark color and when it is considered as a light color. Color comparison is done using gamma-corrected luma values. This is optional and the default value is 43%
amountThis is a percentage value which specifies the amount by which the reference color should be darkened or lightened.
methodThis can either be absolute or relative and defines whether the adjustment should be relative to the current value or not. It is an optional field and the default value is absolute.

Remarks

Contrast

In the contrast function, the output-for-dark-ref-color and output-for-light-ref-color can be provided in any order. The function automatically identifies which is the dark color (to be used when ref color is light) and which is light color (to be used when ref color is dark) based on their own luma values.