Module: ColorContrastCalc::Converter::HueRotate

Defined in:
lib/color_contrast_calc/converter.rb

Class Method Summary collapse

Class Method Details

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

Return a hue rotation applied RGB value of passed color.

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

Parameters:

  • rgb (Array<Integer>)

    The Original RGB value before the rotation

  • deg (Float)

    Degrees of rotation (0 to 360)

Returns:

  • (Array<Integer>)

    Hue rotation applied RGB value



110
111
112
# File 'lib/color_contrast_calc/converter.rb', line 110

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