
Color models an ARGB color with an alpha, red, green, and blue component between 0 and 255. Color is also a solid Brush
.
Slots
- alpha
-
Int alpha()
The alpha component from 0 to 255, where 255 is opaque and 0 is transparent.
- argb
-
const Int argb
The ARGB components masked together: bits 31-24 alpha; bits 16-23 red; bits 8-15 green; bits 0-7 blue.
- b
-
Int b()
The blue component from 0 to 255.
- black
-
static Color black := Color.make(0)
Constant for 0x00_00_00
- blue
-
static Color blue := Color.make(255)
Constant for 0x00_00_ff
- darkGray
-
static Color darkGray := Color.make(11119017)
Constant for 0xa9_a9_a9
- dispose
-
native Void dispose()
Free any operating system resources used by this instance.
- equals
-
override Bool equals(Obj that)
Return argb as the hash code.
- fromStr
-
static Color fromStr(Str s, Bool checked := true)
Parse color from string (see toStr). If invalid and checked is true then throw ParseErr otherwise return null. The following formats are supported:
- #AARRGGBB
- #RRGGBB
- #RGB
Examples:
Color.fromStr("#8A0") Color.fromStr("#88AA00") Color.fromStr("#d088aa00")
- g
-
Int g()
The green component from 0 to 255.
- gray
-
static Color gray := Color.make(8421504)
Constant for 0x80_80_80
- green
-
static Color green := Color.make(65280)
Constant for 0x00_ff_00
- hash
-
override Int hash()
Return argb as the hash code.
- make
-
new make(Int argb := 0, Bool hasAlpha := false)
Make a new instance with the ARGB components masked together: bits 31-24 alpha; bits 16-23 red; bits 8-15 green; bits 0-7 blue. If hasAlpha is false, then we assume the alpha bits are 0xFF.
- orange
-
static Color orange := Color.make(16753920)
Constant for 0xff_a5_00
- purple
-
static Color purple := Color.make(8388736)
Constant for 0x80_00_80
- r
-
Int r()
The red component from 0 to 255.
- red
-
static Color red := Color.make(16711680)
Constant for 0xff_00_00
- rgb
-
Int rgb()
Get the RGB bitmask without the alpha bits.
- toStr
-
override Str toStr()
If the alpha component is 255, then format as
"#RRGGBB"
hex string, otherwise format as"#AARRGGBB"
hex string. - white
-
static Color white := Color.make(16777215)
Constant for 0xff_ff_ff
- yellow
-
static Color yellow := Color.make(16776960)
Constant for 0xff_ff_00