Method: Chroma::Color#complement

Defined in:
lib/chroma/color.rb

#complementColor

Returns the complementary color.

Examples:

'red'.paint.complement #=> cyan

Returns:

  • (Color)

    the complementary color



69
70
71
72
73
# File 'lib/chroma/color.rb', line 69

def complement
  hsl = self.hsl
  hsl.h = (hsl.h + 180) % 360
  self.class.new(hsl, @format)
end