Color class

General purpose Color class. Represent a color as an ARGB value that can be converted to and from num, hex string, hsl, hsla, rgb, rgba and SVG pre- defined color constant.

Implemented types

Constructors

Color(int rgb, [num? alpha])
Create a color with an integer representing the rgb value of red, green, and blue. The value 0xffffff is the color white #ffffff (CSS style). The rgb value of 0xffd700 would map to #ffd700 or the constant Color.gold, where ff is red intensity, d7 is green intensity, and 00 is blue intensity.
Color.createHsla(num hueDegree, num saturationPercent, num lightnessPercent, [num? alpha])
HSL takes three values. The hueDegree degree on the color wheel; '0' is the least and '100' is the greatest. The value '0' or '360' is red, '120' is green, '240' is blue. Numbers in between reflect different shades. The saturationPercent percentage; where'0' is the least and '100' is the greatest (100 represents full color). The lightnessPercent percentage; where'0' is the least and '100' is the greatest. The value 0 is dark or black, 100 is light or white and 50 is a medium lightness.
Color.createRgba(int red, int green, int blue, [num? alpha])
RGB takes three values. The red, green, and blue parameters are the intensity of those components where '0' is the least and '256' is the greatest.
Color.css(String color)
Creates a new color from a CSS color string. For more information, see developer.mozilla.org/en/CSS/color.
Color.hex(String _argb)
Generate a real constant for pre-defined colors (no leading #).
const
Color.hslaRaw(num hue, num saturation, num lightness, [num? alpha])
The hslaRaw takes three values. The hue degree on the color wheel; '0' is the least and '1' is the greatest. The value '0' or '1' is red, the ratio of 120/360 is green, and the ratio of 240/360 is blue. Numbers in between reflect different shades. The saturation is a percentage; '0' is the least and '1' is the greatest. The value of '1' is equivalent to 100% (full colour). The lightness is a percentage; '0' is the least and '1' is the greatest. The value of '0' is dark (black), the value of '1' is light (white), and the value of '.50' is a medium lightness.

Properties

argbValue → int
Return argb as a value (int).
no setteroverride
cssExpression → String
Returns the expression part of a CSS declaration. Declaration is:
no setter
hashCode → int
The hash code for this object.
no setteroverride
hsla → Hsla
no setter
rgba → Rgba
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

darker(num amount) → Color
lighter(num amount) → Color
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toHexArgbString() → String
Canonical form for color #rrggbb with alpha blending (0.0 == full transparency and 1.0 == fully opaque). If _argb length is 6 it's an rrggbb otherwise it's aarrggbb.
override
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Properties

aliceBlue → Color
final
antiqueWhite → Color
final
aqua → Color
final
aquaMarine → Color
final
azure → Color
final
beige → Color
final
bisque → Color
final
black → Color
final
blanchedAlmond → Color
final
blue → Color
final
blueViolet → Color
final
brown → Color
final
burlyWood → Color
final
cadetBlue → Color
final
chartreuse → Color
final
chocolate → Color
final
coral → Color
final
cornFlowerBlue → Color
final
cornSilk → Color
final
crimson → Color
final
cyan → Color
final
darkBlue → Color
final
darkCyan → Color
final
darkGoldenRod → Color
final
darkGray → Color
final
darkGreen → Color
final
darkGrey → Color
final
darkKhaki → Color
final
darkMagenta → Color
final
darkOliveGreen → Color
final
darkOrange → Color
final
darkOrchid → Color
final
darkRed → Color
final
darkSalmon → Color
final
darkSeaGreen → Color
final
darkSlateBlue → Color
final
darkSlateGray → Color
final
darkSlateGrey → Color
final
darkTurquoise → Color
final
darkViolet → Color
final
deepPink → Color
final
deepSkyBlue → Color
final
dimGray → Color
final
dimGrey → Color
final
dodgerBlue → Color
final
fireBrick → Color
final
floralWhite → Color
final
forestGreen → Color
final
fuchsia → Color
final
gainsboro → Color
final
ghostWhite → Color
final
gold → Color
final
goldenRod → Color
final
gray → Color
final
green → Color
final
greenYellow → Color
final
grey → Color
final
honeydew → Color
final
hotPink → Color
final
indianRed → Color
final
indigo → Color
final
ivory → Color
final
khaki → Color
final
lavender → Color
final
lavenderBlush → Color
final
lawnGreen → Color
final
lemonChiffon → Color
final
lightBlue → Color
final
lightCoral → Color
final
lightCyan → Color
final
lightGoldenRodYellow → Color
final
lightGray → Color
final
lightGreen → Color
final
lightGrey → Color
final
lightPink → Color
final
lightSalmon → Color
final
lightSeaGreen → Color
final
lightSkyBlue → Color
final
lightSlateGray → Color
final
lightSlateGrey → Color
final
lightSteelBlue → Color
final
lightYellow → Color
final
lime → Color
final
limeGreen → Color
final
linen → Color
final
magenta → Color
final
maroon → Color
final
mediumAquaMarine → Color
final
mediumBlue → Color
final
mediumOrchid → Color
final
mediumPurple → Color
final
mediumSeaGreen → Color
final
mediumSlateBlue → Color
final
mediumSpringGreen → Color
final
mediumTurquoise → Color
final
mediumVioletRed → Color
final
midnightBlue → Color
final
mintCream → Color
final
mistyRose → Color
final
moccasin → Color
final
final
final
oldLace → Color
final
olive → Color
final
oliveDrab → Color
final
orange → Color
final
orangeRed → Color
final
orchid → Color
final
paleGoldenRod → Color
final
paleGreen → Color
final
paleTurquoise → Color
final
paleVioletRed → Color
final
papayaWhip → Color
final
peachPuff → Color
final
peru → Color
final
pink → Color
final
plum → Color
final
powderBlue → Color
final
purple → Color
final
red → Color
final
rosyBrown → Color
final
royalBlue → Color
final
saddleBrown → Color
final
salmon → Color
final
sandyBrown → Color
final
seaGreen → Color
final
seashell → Color
final
sienna → Color
final
silver → Color
final
skyBlue → Color
final
slateBlue → Color
final
slateGray → Color
final
slateGrey → Color
final
snow → Color
final
springGreen → Color
final
steelBlue → Color
final
tan → Color
final
teal → Color
final
thistle → Color
final
tomato → Color
final
transparent → Color
final
turquoise → Color
final
violet → Color
final
wheat → Color
final
white → Color
final
whiteSmoke → Color
final
yellow → Color
final
yellowGreen → Color
final

Static Methods

convertToHexString(int r, int g, int b, [num? a]) → String
equal(ColorBase curr, Object other) → bool
hexToInt(String hex) → int