Class: ColorConverters::HsvConverter

Inherits:
BaseConverter show all
Defined in:
lib/color_converters/converters/hsv_converter.rb

Constant Summary

Constants inherited from BaseConverter

BaseConverter::IMPORT_DP, BaseConverter::OUTPUT_DP

Instance Attribute Summary

Attributes inherited from BaseConverter

#original_value, #rgba

Class Method Summary collapse

Methods inherited from BaseConverter

#alpha, #cielab, #cielch, #cmyk, factory, #hex, #hsb, #hsl, #hsv, inherited, #initialize, #name, #oklab, #oklch, #rgb, #xyz

Constructor Details

This class inherits a constructor from ColorConverters::BaseConverter

Class Method Details

.boundsObject



11
12
13
# File 'lib/color_converters/converters/hsv_converter.rb', line 11

def self.bounds
  { h: [0.0, 360.0], s: [-128.0, 127.0], v: [-128.0, 127.0], b: [-128.0, 127.0] }
end

.matches?(colour_input) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/color_converters/converters/hsv_converter.rb', line 5

def self.matches?(colour_input)
  return false unless colour_input.is_a?(Hash)

  colour_input.keys - [:h, :s, :v] == [] || colour_input.keys - [:h, :s, :b] == []
end