Method: ColorMath::Color#compact_hex
- Defined in:
- lib/colormath/color.rb
#compact_hex ⇒ Object
The hexadecimal representation of the colour, using 3 digits if possible
15 16 17 18 19 20 21 22 |
# File 'lib/colormath/color.rb', line 15 def compact_hex case h = hex when /^#(.)\1(.)\2(.)\3$/ "##$1#$2#$3" else h end end |