Method: Color::Palette::MonoContrast#brightness_diff

Defined in:
lib/color/palette/monocontrast.rb

#brightness_diff(c1, c2) ⇒ Object

Returns the absolute difference between the brightness levels of two colours. This will be a decimal value between 0 and 1. W3C accessibility guidelines for colour contrast suggest that this value be at least approximately 0.49 (125 / 255.0) for proper contrast.


150
151
152
# File 'lib/color/palette/monocontrast.rb', line 150

def brightness_diff(c1, c2)
  (c1.brightness - c2.brightness).abs
end