module Sass::Script::Functions

def rgb(red, green, blue)

Parameters:
  • blue () --
  • green () --
  • red () --
def rgb(red, green, blue)
  assert_type red, :Number
  assert_type green, :Number
  assert_type blue, :Number
  rgb = [red, green, blue].map do |c|
    v = c.value
    if c.numerator_units == ["%"] && c.denominator_units.empty?
      next v * 255 / 100.0 if (0..100).include?(v)
      raise ArgumentError.new("Color value #{c} must be between 0% and 100% inclusive")
    else
      next v if (0..255).include?(v)
      raise ArgumentError.new("Color value #{v} must be between 0 and 255 inclusive")
    end
  end
  Color.new(rgb)
end