def ratio(rgb1, rgb2)
      raise InvalidColorError, rgb1 unless valid_rgb?(rgb1)
      raise InvalidColorError, rgb2 unless valid_rgb?(rgb2)

      srgb1 = rgb_to_srgba(rgb1)
      srgb2 = rgb_to_srgba(rgb2)

      l1 = srgb_lightness(srgb1)
      l2 = srgb_lightness(srgb2)

      l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05)
    end
def ratio(rgb1, rgb2)
      raise InvalidColorError, rgb1 unless valid_rgb?(rgb1)
      raise InvalidColorError, rgb2 unless valid_rgb?(rgb2)

      srgb1 = rgb_to_srgba(rgb1)
      srgb2 = rgb_to_srgba(rgb2)

      l1 = srgb_lightness(srgb1)
      l2 = srgb_lightness(srgb2)

      l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05)
    end
Calculate contast ratio beetween RGB1 and RGB2.