Module: ColorContrastCalc::Converter::Saturate

Defined in:
lib/color_contrast_calc/converter.rb

Class Method Summary collapse

Class Method Details

.calc_rgb(rgb, s) ⇒ Array<Integer>

Return a saturated RGB value of passed color.

The calculation is based on the definition found at www.w3.org/TR/filter-effects/#funcdef-saturate www.w3.org/TR/SVG/filters.html#feColorMatrixElement

Parameters:

  • rgb (Array<Integer>)

    The Original RGB value before the saturation

  • s (Float)

    Proprtion of the conversion in percentage

Returns:

  • (Array<Integer>)

    Saturated RGB value



146
147
148
# File 'lib/color_contrast_calc/converter.rb', line 146

def self.calc_rgb(rgb, s)
  Converter.rgb_map((calc_saturation(s) * Vector[*rgb]).to_a)
end