Class: Abachrome::ColorModels::HSV

Inherits:
Base
  • Object
show all
Defined in:
lib/abachrome/color_models/hsv.rb

Instance Method Summary collapse

Instance Method Details

#valid_coordinates?(coordinates) ⇒ Boolean

Validates whether the coordinates are valid for the HSV color model. Each component (hue, saturation, value) must be in the range [0, 1].

hue (h), saturation (s), and value (v) in the range [0, 1]

Parameters:

  • coordinates (Array<Numeric>)

    An array of three values representing

Returns:

  • (Boolean)

    true if all coordinates are within valid ranges, false otherwise



37
38
39
40
41
42
# File 'lib/abachrome/color_models/hsv.rb', line 37

def valid_coordinates?(coordinates)
  h, s, v = coordinates
  h >= 0 && h <= 1.0 &&
    s >= 0 && s <= 1.0 &&
    v >= 0 && v <= 1.0
end