class Colors::HUSL
Human-friendly alternative to HSL
color space. The definition of HUSL
is provided in <www.hsluv.org>.
Public Instance Methods
==(other)
click to toggle source
# File lib/colors/husl.rb, line 5 def ==(other) case other when HUSL h == other.h && s == other.s && l == other.l else other == self end end
desaturate(factor)
click to toggle source
# File lib/colors/husl.rb, line 14 def desaturate(factor) to_rgb.desaturate(factor).to_husl end
lch_components()
click to toggle source
# File lib/colors/husl.rb, line 35 def lch_components l = self.l * 100r s = self.s * 100r if l > 99.9999999 || l < 1e-8 c = 0r else mx = Convert.max_chroma(l, h) c = mx / 100r * s end h = s < 1e-8 ? 0r : self.h [l, c, h] end
rgb_components()
click to toggle source
# File lib/colors/husl.rb, line 31 def rgb_components to_xyz.rgb_components end
to_husl()
click to toggle source
# File lib/colors/husl.rb, line 18 def to_husl self end
to_rgb()
click to toggle source
# File lib/colors/husl.rb, line 22 def to_rgb RGB.new(*rgb_components) end
to_xyz()
click to toggle source
# File lib/colors/husl.rb, line 26 def to_xyz x, y, z = Convert.lch_to_xyz(*lch_components) XYZ.new(x, y, z) end