Module: SudoRails::Styling
- Included in:
- SudoRails
- Defined in:
- lib/sudo_rails/styling.rb
Instance Method Summary collapse
Instance Method Details
#color_contrast(hex_color) ⇒ Object
7 8 9 10 11 |
# File 'lib/sudo_rails/styling.rb', line 7 def color_contrast(hex_color) return nil unless hex_color.include?('#') hex_color.delete('#').scan(/../).sum { |color| color.hex } > 382.5 ? '#000' : '#fff' end |