Files

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
40:     def self.available
41:       self.instance_methods.map(&:to_sym)
42:     end

Public Instance Methods

hsl(*args) click to toggle source
    # File lib/less/engine/nodes/function.rb, line 10
10:     def hsl *args
11:       hsla *[args, 1.0].flatten
12:     end
hsla(h, s, l, a = 1.0) click to toggle source

HSLA to RGBA

    # File lib/less/engine/nodes/function.rb, line 24
24:     def hsla h, s, l, a = 1.0
25:       m2 = ( l <= 0.5 ) ? l * ( s + 1 ) : l + s - l * s
26:       m1 = l * 2 - m2;
27: 
28:       hue = lambda do |h|
29:         h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h)
30:         if    h * 6 < 1 then m1 + (m2 - m1) * h * 6
31:         elsif h * 2 < 1 then m2 
32:         elsif h * 3 < 2 then m1 + (m2 - m1) * (2/3 - h) * 6 
33:         else m1
34:         end
35:       end
36: 
37:       rgba hue[ h + 1/3 ], hue[ h ], hue[ h - 1/3 ], a
38:     end
rgb(*rgb) click to toggle source
   # File lib/less/engine/nodes/function.rb, line 6
6:     def rgb *rgb
7:       rgba rgb, 1.0
8:     end
rgba(*rgba) click to toggle source

RGBA to Node::Color

    # File lib/less/engine/nodes/function.rb, line 17
17:     def rgba *rgba
18:       Node::Color.new *rgba.flatten
19:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.