class Chroma::RgbGenerator::FromHslValues
Public Class Methods
new(format, h, s, l, a = 1)
click to toggle source
@param format [Symbol] color format @param h [String, Numeric] hue value @param s [String, Numeric] saturation value @param l [String, Numeric] lightness value @param a [String, Numeric] alpha value
# File lib/chroma/rgb_generator/from_hsl_values.rb, line 9 def initialize(format, h, s, l, a = 1) s = to_percentage(s) l = to_percentage(l) @format = format || :hsl @hsl = ColorModes::Hsl.new(h, s, l, a) end
Public Instance Methods
generate()
click to toggle source
Generates a {ColorModes::Rgb}. @return [ColorModes::Rgb]
# File lib/chroma/rgb_generator/from_hsl_values.rb, line 19 def generate [Converters::RgbConverter.convert_hsl(@hsl), @format] end