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

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

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

Public Instance methods

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.

Returns the luminosity (l) of the colour.

Present the colour as an HTML/CSS colour string.

Converts to RGB then CMYK.

to_grayscale()

Alias for to_greyscale

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

Converts to RGB then YIQ.

[Validate]