Method: ColorContrastCalc::ColorFunctionParser::ColorFunction#opacity

Defined in:
lib/color_contrast_calc/color_function_parser.rb

#opacityFloat

Return the opacity of a color presented as a RGB/HSL/HWB function. The returned value is normalized to a floating number between 0 and 1.

Returns:

  • (Float)

    Normalized opacity



250
251
252
# File 'lib/color_contrast_calc/color_function_parser.rb', line 250

def opacity
  @opacity ||= @normalized.length == 3 ? 1.0 : @normalized.last
end