Module Color
In: lib/color/grayscale.rb
lib/color.rb

Colour Management with Ruby

Methods

Classes and Modules

Module Color::CSS
Module Color::Palette
Class Color::CMYK
Class Color::GrayScale
Class Color::HSL
Class Color::RGB
Class Color::YIQ

Constants

GreyScale = GrayScale   A synonym for Color::GrayScale.
COLOR_VERSION = '1.4.1'
COLOR_EPSILON = 1e-5   The maximum "resolution" for colour math; if any value is less than or equal to this value, it is treated as zero.
COLOR_TOLERANCE = 1e-4   The tolerance for comparing the components of two colours. In general, colours are considered equal if all of their components are within this tolerance value of each other.

External Aliases

normalize -> normalize_fractional
normalize_byte -> normalize_8bit
normalize_word -> normalize_16bit

Public Class methods

Returns true if the value is within COLOR_EPSILON of one.

Returns true if the value is within COLOR_EPSILON of one or more than one.

Returns true if the value is less than COLOR_EPSILON.

Returns true if the value is within COLOR_EPSILON of zero or less than zero.

Provides a thin veneer over the Color module to make it seem like this is Color 0.1.0 (a class) and not Color 1.4.1 (a module). This "constructor" will be removed in the future.

mode = :hsl:values must be an array of [ hue deg, sat %, lum % ]. A Color::HSL object will be created.
mode = :rgb:values will either be an HTML-style colour string or an array of [ red, green, blue ] (range 0 .. 255). A Color::RGB object will be created.
mode = :cmyk:values must be an array of [ cyan %, magenta %, yellow %, black % ]. A Color::CMYK object will be created.

Normalizes the value to the range (0.0) .. (1.0).

Normalize the value to the range (0) .. (255).

Normalize the value to the range (0) .. (65535).

[Validate]