The alpha component from 0.0 to 1.0
Return this
The blue component from 0 to 255.
Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:
this < that => <0
this == that => 0
this > that => >0
This method may also be accessed via the <
<=
<=>
>=
and >
shortcut operators. If not overridden the default
implementation compares the toStr
representations. Also see docLang.
Examples:
3.compare(8) => -1
8.compare(3) => 1
8.compare(8) => 0
3 <=> 8 => -1 // shortcut for 3.compare(8)
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.
Optional
percentage: numberThe green component from 0 to 255.
Return the hash code.
Always return true
Return if a is 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.
Optional
percentage: numberAdjust the opacity of this color and return new instance,
where opacity
is between 0.0 and 1.0.
Optional
opacity: numberThe red component from 0 to 255.
The RGB components masked together: bits 16-23 red; bits 8-15 green; bits 0-7 blue.
Format as #RGB, #RRGGBB or #RRGGBBAA syntax
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
If the alpha component is 1.0, then format as "#RRGGBB"
hex
string, otherwise format as "rbga()"
notation.
Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:
a->x a.trap("x", null)
a->x() a.trap("x", null)
a->x = b a.trap("x", [b])
a->x(b) a.trap("x", [b])
a->x(b, c) a.trap("x", [b, c])
The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.
This method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Static
blackBlack is #000
Static
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
fromParse color from CSS 4 string. If invalid and checked is true then throw ParseErr otherwise return null. The following formats are supported:
Functional notation works with comma or space separated arguments.
Examples:
Color.fromStr("red")
Color.fromStr("#8A0")
Color.fromStr("#88AA00")
Color.fromStr("rgba(255, 0, 0, 0.3)")
Color.fromStr("rgb(100% 0% 0% 25%)")
Optional
checked: booleanStatic
interpolateStatic
interpolateStatic
makeMake 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.
Optional
rgb: numberOptional
a: numberStatic
makeStatic
makeMake a new instance with the RGB individual components as integers between 0 and 255 and alpha as float between 1.0 and 0.0.
Optional
a: numberStatic
transparentTransparent constant with opacity set to zero
Static
whiteWhite is #FFF
Models an CSS4 RGB color with alpha