Introduction
The Colour object represents a colour value within ZPE.
Internally, it wraps a java.awt.Color instance while preserving the original
colour string supplied at construction.
This object is typically used in conjunction with UI-related components or plugins that require colour configuration.
A Colour object is created using its constructor and a string representation of the colour.
All functions exposed by this object require a permission level of 0.
Colour object functions
The following is a list of internal functions the Colour object exposes. All functions are ZPEObjectNativeFunctions therefore run in native code.
-
_construct(string colourString) ⇒ Colour -
Constructs a Colour object from a string representation.
The supplied string is parsed into an internal
java.awt.Colorinstance. The constructor returns the Colour object itself.
Examples
The following example creates a Colour object using a hexadecimal colour string:
$colour = new Colour("#FF6600") print($colour)
In this example, the Colour object stores both:
- The parsed
java.awt.Colorinstance (used internally) - The original string representation (returned when converted to a string)
This example demonstrates assigning a named colour:
$blue = new Colour("blue") print($blue)
Notes:
-
String formats: Supported formats depend on the internal colour parser
(for example hexadecimal values such as
#RRGGBBor named colours). - String conversion: Converting a Colour object to a string returns the original colour string used during construction.
- UI usage: This object is primarily intended for UI and rendering contexts.

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.
Comments powered by BalfComment