Class

RGB

Extends:

An RGB colour object.

Modules
Metallic This namespace contains some RGB metallic colours suggested by Jim Freeze.
Constants
AliceBlue
AntiqueWhite
Aqua
Aquamarine
Azure
Beige
Bisque
Black
BlanchedAlmond
Blue
BlueViolet
Brown
BurlyWood
Burlywood
CadetBlue
Chartreuse
Chocolate
Coral
CornflowerBlue
Cornsilk
Crimson
Cyan
DarkBlue
DarkCyan
DarkGoldenRod
DarkGoldenrod
DarkGray
DarkGreen
DarkGrey
DarkKhaki
DarkMagenta
DarkOliveGreen
DarkOrange
DarkOrchid
DarkRed
DarkSalmon
DarkSeaGreen
DarkSlateBlue
DarkSlateGray
DarkSlateGrey
DarkTurquoise
DarkViolet
DarkoliveGreen
Darkorange
Darksalmon
DeepPink
DeepSkyBlue
DimGray
DimGrey
DodgerBlue
Feldspar
FireBrick
Firebrick
FloralWhite
ForestGreen
Fuchsia
Gainsboro
GhostWhite
Gold
GoldenRod
Goldenrod
Gray
Gray10
Gray20
Gray30
Gray40
Gray50
Gray60
Gray70
Gray80
Gray90
Green
GreenYellow
Grey
HoneyDew
Honeydew
HotPink
IndianRed
Indigo
Ivory
Khaki
Lavender
LavenderBlush
LawnGreen
LemonChiffon
LightBlue
LightCoral
LightCyan
LightGoldenRodYellow
LightGoldenrodYellow
LightGray
LightGreen
LightGrey
LightPink
LightSalmon
LightSeaGreen
LightSkyBlue
LightSlateBlue
LightSlateGray
LightSlateGrey
LightSteelBlue
LightYellow
Lightsalmon
LightsteelBlue
Lime
LimeGreen
Linen
Magenta
Maroon
MediumAquaMarine
MediumAquamarine
MediumBlue
MediumOrchid
MediumPurple
MediumSeaGreen
MediumSlateBlue
MediumSpringGreen
MediumTurquoise
MediumVioletRed
MidnightBlue
MintCream
MistyRose
Moccasin
NavajoWhite
Navy
OldLace
Olive
OliveDrab
Olivedrab
Orange
OrangeRed
Orchid
PDF_FORMAT_STR The format of a DeviceRGB colour for PDF. In color-tools 2.0 this will be removed from this package and added back as a modification by the PDF::Writer package.
PaleGoldenRod
PaleGoldenrod
PaleGreen
PaleTurquoise
PaleVioletRed
PapayaWhip
PeachPuff
Peachpuff
Peru
Pink
Plum
PowderBlue
Purple
Red
RosyBrown
RoyalBlue
SaddleBrown
Salmon
SandyBrown
SeaGreen
SeaShell
Seashell
Sienna
Silver
SkyBlue
SlateBlue
SlateGray
SlateGrey
Snow
SpringGreen
SteelBlue
Tan
Teal
Thistle
Tomato
Turquoise
Violet
VioletRed
Wheat
White
WhiteSmoke
Yellow
YellowGreen
Public Attributes
b
g
r
Public Methods
== Compares the other colour to this one. The other colour will be converted to RGB before comparison, so the comparison between a RGB colour and a non-RGB colour will be approximate and based on the other colour’s default #to_rgb conversion. If there is no #to_rgb conversion, this will raise an exception. This will report that two RGB colours are equivalent if all component values are within 1e-4 (0.0001) of each other.
adjust_brightness Returns a new colour with the brightness adjusted by the specified percentage. Negative percentages will darken the colour; positive percentages will brighten the colour.
adjust_hue Returns a new colour with the hue adjusted by the specified percentage. Negative percentages will reduce the hue; positive percentages will increase the hue.
adjust_saturation Returns a new colour with the saturation adjusted by the specified percentage. Negative percentages will reduce the saturation; positive percentages will increase the saturation.
b=
brightness Returns the brightness value for a colour, a number between 0..1. Based on the Y value of YIQ encoding, representing luminosity, or perceived brightness.
darken_by Mix the RGB hue with Black so that the RGB hue is the specified percentage of the resulting colour. Strictly speaking, this isn’t a darken_by operation.
from_fraction Creates an RGB colour object from fractional values 0..1.
from_html Creates an RGB colour object from an HTML colour descriptor (e.g., "fed" or "#cabbed;".
from_percentage Creates an RGB colour object from percentages 0..100.
g=
html Present the colour as an HTML/CSS colour string.
lighten_by Mix the RGB hue with White so that the RGB hue is the specified percentage of the resulting colour. Strictly speaking, this isn’t a darken_by operation.
mix_with Mix the mask colour (which must be an RGB object) with the current colour at the stated opacity percentage (0..100).
new Creates an RGB colour object from the standard range 0..255.
pdf_fill Present the colour as a DeviceRGB fill colour string for PDF. This will be removed from the default package in color-tools 2.0.
pdf_stroke Present the colour as a DeviceRGB stroke colour string for PDF. This will be removed from the default package in color-tools 2.0.
r=
to_cmyk Converts the RGB colour to CMYK. Most colour experts strongly suggest that this is not a good idea (some even suggesting that it’s a very bad idea). CMYK represents additive percentages of inks on white paper, whereas RGB represents mixed colour intensities on a black screen.
to_grayscale
to_greyscale Alias for #to_grayscale
to_hsl Returns the HSL colour encoding of the RGB value.
to_rgb
to_yiq Returns the YIQ (NTSC) colour encoding of the RGB value.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.