Models an ARGB color (alpha, red, green, blue). Color is also a solid Brush
.
Slots
- aSource
-
Int a()
The alpha component from 0 to 255, where 255 is opaque and 0 is transparent.
- argbSource
-
const Int argb
The ARGB components masked together: bits 31-24 alpha; bits 16-23 red; bits 8-15 green; bits 0-7 blue.
- bSource
-
Int b()
The blue component from 0 to 255.
- blackSource
-
static Color black := Color.make(0)
Constant for 0x00_00_00
- blueSource
-
static Color blue := Color.make(255)
Constant for 0x00_00_ff
- darkGraySource
-
static Color darkGray := Color.make(11119017)
Constant for 0xa9_a9_a9
- darkerSource
-
Color darker(Float percentage := 0.2)
Get a color which is a dark shade of this color. This decreases the brightness by the given percentage which is a float between 0.0 and 1.0.
- equalsSource
-
override Bool equals(Obj? that)
Overrides sys::Obj.equals
Return argb as the hash code.
- fromStrSource
-
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")
- gSource
-
Int g()
The green component from 0 to 255.
- graySource
-
static Color gray := Color.make(8421504)
Constant for 0x80_80_80
- greenSource
-
static Color green := Color.make(65280)
Constant for 0x00_ff_00
- hSource
-
Float h()
Hue as a float between 0.0 and 360.0 of the HSV model (hue, saturation, value), also known as HSB (hue, saturation, brightness). Also see makeHsv, s, v.
- hashSource
-
override Int hash()
Overrides sys::Obj.hash
Return argb as the hash code.
- lighterSource
-
Color lighter(Float percentage := 0.2)
Get a color which is a lighter shade of this color. This increases the brightness by the given percentage which is a float between 0.0 and 1.0.
- makeSource
-
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.
- makeHsvSource
-
static Color makeHsv(Float h, Float s, Float v)
Construct a color using HSV model (hue, saturation, value), also known as HSB (hue, saturation, brightness):
- orangeSource
-
static Color orange := Color.make(16753920)
Constant for 0xff_a5_00
- purpleSource
-
static Color purple := Color.make(8388736)
Constant for 0x80_00_80
- rSource
-
Int r()
The red component from 0 to 255.
- redSource
-
static Color red := Color.make(16711680)
Constant for 0xff_00_00
- rgbSource
-
Int rgb()
Get the RGB bitmask without the alpha bits.
- sSource
-
Float s()
Saturation as a float between 0.0 and 1.0 of the HSV model (hue, saturation, value), also known as HSB (hue, saturation, brightness). Also see makeHsv, h, v.
- toCssSource
-
Str toCss()
To a valid CSS color string.
- toStrSource
-
override Str toStr()
Overrides sys::Obj.toStr
If the alpha component is 255, then format as
"#RRGGBB"
hex string, otherwise format as"#AARRGGBB"
hex string. - vSource
-
Float v()
Value or brightness as a float between 0.0 and 1.0 of the HSV model (hue, saturation, value), also known as HSB (hue, saturation, brightness). Also see makeHsv, h, s.
- whiteSource
-
static Color white := Color.make(16777215)
Constant for 0xff_ff_ff
- yellowSource
-
static Color yellow := Color.make(16776960)
Constant for 0xff_ff_00