Module: ColorContrastCalc::Converter::Brightness
- Defined in:
- lib/color_contrast_calc/converter.rb
Class Method Summary collapse
-
.calc_rgb(rgb, ratio = 100) ⇒ Array<Integer>
Return brightness adjusted RGB value of passed color.
Class Method Details
.calc_rgb(rgb, ratio = 100) ⇒ Array<Integer>
Return brightness adjusted RGB value of passed color.
The calculation is based on the definition found at www.w3.org/TR/filter-effects/#funcdef-brightness www.w3.org/TR/SVG/filters.html#TransferFunctionElementAttributes
112 113 114 115 |
# File 'lib/color_contrast_calc/converter.rb', line 112 def self.calc_rgb(rgb, ratio = 100) r = ratio.to_f Converter.rgb_map(rgb) {|c| c * r / 100 } end |