Module: ColoR
- Defined in:
- lib/color.rb,
lib/color/version.rb
Overview
Offering functionality to get the complementary colors of a given input.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.4"
Class Method Summary collapse
Class Method Details
.get_complementary_color(color) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/color.rb', line 10 def self.get_complementary_color(color) raise HexCodeError.new("Not a valid Hex Color"), color unless ::Hex.hex?(color) rgb_color = ::RGB.hex_to_rgb(color) comp_r = [255 - rgb_color[0], 255 - rgb_color[1], 255 - rgb_color[2]] ::RGB.rgb_to_hex(comp_r) end |