Color class

General purpse 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 Methods

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

Constants

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