Class: Color::HSL

Class | Color::HSL
In: | lib/color/hsl.rb
Parent: | Object

An HSL colour object. Internally, the hue (h), saturation (s), and luminosity (l) values are dealt with as fractional values in the range 0..1.

### Methods

== brightness from_fraction html new to_cmyk to_grayscale to_greyscale to_rgb to_yiq

### Attributes

h | [RW] |
l | [RW] |
s | [RW] |

### Public Class methods

from_fraction(h = 0.0, s = 0.0, l = 0.0)

Creates an HSL colour object from fractional values 0..1.

new(h = 0, s = 0, l = 0)

Creates an HSL colour object from the standard values of degrees and percentages (e.g., 145º, 30%, 50%).

### Public Instance methods

==(other)

Compares the other colour to this one. The other colour will be converted to HSL before comparison, so the comparison between a HSL colour and a non-HSL colour will be approximate and based on the other colour‘s to_hsl conversion. If there is no to_hsl conversion, this will raise an exception. This will report that two HSL values are equivalent if all component values are within 1e-4 (0.0001) of each other.

brightness()

Returns the luminosity (l) of the colour.

html()

Present the colour as an HTML/CSS colour string.

to_cmyk()

Converts to RGB then CMYK.

to_grayscale()

Alias for to_greyscale

to_greyscale()
to_rgb(ignored = nil)

Converting to HSL as adapted from Foley and Van-Dam from www.bobpowell.net/RGBHSB.htm.

to_yiq()

Converts to RGB then YIQ.

[Validate]