const class graphics::Color
Models an CSS4 RGB color with alpha
const Float a
The alpha component from 0.0 to 1.0
The blue component from 0 to 255.
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.
Parse color from CSS 4 string. If invalid and checked is true then throw ParseErr otherwise return null. The following formats are supported:
- CSS keyword color
- rgb(r, g b)
- rgba(r, g, b, a)
- hsl(h, s, l)
- hsla(h, s, l, a)
Functional notation works with comma or space separated arguments.
Color.fromStr("red") Color.fromStr("#8A0") Color.fromStr("#88AA00") Color.fromStr("rgba(255, 0, 0, 0.3)") Color.fromStr("rgb(100% 0% 0% 25%)")
The green component from 0 to 255.
virtual override Int hash()
Return the hash code.
Interpolate between a and b where t is 0.0 to 1.0 using HSL color model.
Interpolate between a and b where t is 0.0 to 1.0 using RGB color model.
ais zero, fully transparent
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.
Make a new instance with the RGB components masked together: bits 16-23 red; bits 8-15 green; bits 0-7 blue. Alpha should be a float between 1.0 and 0.0.
Construct a color using HSL model (hue, saturation, lightness):
Make a new instance with the RGB individual components as integers between 0 and 255 and alpha as float between 1.0 and 0.0.
Adjust the opacity of this color and return new instance, where
opacityis between 0.0 and 1.0.
The red component from 0 to 255.
const Int rgb
The RGB components masked together: bits 16-23 red; bits 8-15 green; bits 0-7 blue.
Adjust saturation as percentage between -1..1.
Format as #RGB, #RRGGBB or #RRGGBBAA syntax
virtual override Str toStr()
If the alpha component is 1.0, then format as
"#RRGGBB"hex string, otherwise format as
const static Color transparent := Color.make(0, 0.0)
Transparent constant with opacity set to zero