Method: Inker::Color::Tools#lightness
- Defined in:
- lib/inker/color/tools.rb
#lightness(red, green, blue) ⇒ Float
Calculate the lightness of a color from RGB components.
41 42 43 44 45 |
# File 'lib/inker/color/tools.rb', line 41 def lightness(red, green, blue) min, max = [red, green, blue].minmax (min + max) / (2.0 * 255) end |