class Chroma::RgbGenerator::FromHsvValues

Public Class Methods

new(format, h, s, v, a = 1) click to toggle source

@param format [Symbol] color format @param h [String, Numeric] hue value @param s [String, Numeric] saturation value @param v [String, Numeric] value value @param a [String, Numeric] alpha value

# File lib/chroma/rgb_generator/from_hsv_values.rb, line 9
def initialize(format, h, s, v, a = 1)
  s = to_percentage(s)
  v = to_percentage(v)

  @format = format || :hsv
  @hsv = ColorModes::Hsv.new(h, s, v, a)
end

Public Instance Methods

generate() click to toggle source

Generates a {ColorModes::Rgb}. @return [ColorModes::Rgb]

# File lib/chroma/rgb_generator/from_hsv_values.rb, line 19
def generate
  [Converters::RgbConverter.convert_hsv(@hsv), @format]
end