Color Arrays
A color is represented in JavaScript as an array containing 1, 2, 4, or 5 elements corresponding
to a transparent, gray, RGB, or CMYK color space, respectively. The first element in the array
is a string denoting the color space type. The subsequent elements are numbers that range
between zero and one inclusive. The following table illustrates this:
Color Space
String
# of Additional
Elements
0
1
3
4
Transparent
Gray
RGB
CMYK
“T”
“G”
“RGB”
“CMYK”
For example, the color red can be represented as [“RGB” 1 0 0].
Invalid strings or insufficient elements in a color array cause the color to be interpreted as the
color black.
A
transparent
color space indicates a complete absence of color and will allow those portions
of the document underlying the current field to show through.
Colors in the
gray
color space are represented by a single value—the intensity of achromatic
light. In this color space, 0 is black, 1 is white, and intermediate values represent shades of
gray (i.e. “.5”, “.7” etc.).
Colors in the
RGB
color space are represented by three values: the intensity of the
red, green,
and
blue
components in the output. RGB is commonly used for video displays because they are
generally based on red, green, and blue phosphors.
Colors in the
CMYK
color space are represented by four values. These values are the amounts
of the
cyan, magenta, yellow,
and
black
components in the output. This color space is
commonly used for color printers, where they are the colors of the inks traditionally used in
four-color printing. Only cyan, magenta, and yellow are necessary, but black is generally used
in printing because black ink produces a better black than a mixture of cyan, magenta, and
yellow inks, and because black ink is less expensive than the other inks.
Color Object
The
color
object is a convenience static object that defines the basic colors. These colors are
accessed in JavaScripts via the color object. Use this object whenever you want to set a
property or call a method that require a color array. The color object is defined in
AForm.js.
Acrobat Forms - JavaScript Object Specification
17
Index Bookmark Pages Text
Previous Next
Pages: Index All Pages
This HTML file was created by VeryPDF PDF to HTML Converter product.