Sha256: 84fee2b07343c2af91a1d131c47f85be2d95d0bbcd8e14d74db7231c51997b85
Contents?: true
Size: 712 Bytes
Versions: 4
Compression:
Stored size: 712 Bytes
Contents
module Chroma module RgbGenerator class FromHslValues < Base # @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 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 # Generates a {ColorModes::Rgb}. # @return [ColorModes::Rgb] def generate [Converters::RgbConverter.convert_hsl(@hsl), @format] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems