module Less::Functions
Functions useable from within the style-sheet go here
Public Class Methods
available()
click to toggle source
# File lib/less/engine/nodes/function.rb, line 40 def self.available self.instance_methods.map(&:to_sym) end
Public Instance Methods
hsl(*args)
click to toggle source
# File lib/less/engine/nodes/function.rb, line 10 def hsl *args hsla *[args, 1.0].flatten end
hsla(h, s, l, a = 1.0)
click to toggle source
HSLA to RGBA
# File lib/less/engine/nodes/function.rb, line 24 def hsla h, s, l, a = 1.0 m2 = ( l <= 0.5 ) ? l * ( s + 1 ) : l + s - l * s m1 = l * 2 - m2; hue = lambda do |h| h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h) if h * 6 < 1 then m1 + (m2 - m1) * h * 6 elsif h * 2 < 1 then m2 elsif h * 3 < 2 then m1 + (m2 - m1) * (2/3 - h) * 6 else m1 end end rgba hue[ h + 1/3 ], hue[ h ], hue[ h - 1/3 ], a end
rgb(*rgb)
click to toggle source
# File lib/less/engine/nodes/function.rb, line 6 def rgb *rgb rgba rgb, 1.0 end
rgba(*rgba)
click to toggle source
RGBA to Node::Color
# File lib/less/engine/nodes/function.rb, line 17 def rgba *rgba Node::Color.new *rgba.flatten end