Colors
We think of colors as the spectrum of the rainbow, but the computer builds up all colors from just three: red, green, and blue. By varying the relative intensity of these three colors the computer can generate all the colors of the rainbow. A Panorama color data item combines red, green, and blue intensity values into a single raw binary data item (see Binary Data).

#### RGB Color

Macintosh measures color intensity on a scale from 0 (completely dark) to 65,535 (full brightness). Values in between denote intermediate intensity. By combining the three primary colors with different intensities you can create virtually any color. The table below shows a small sample of the colors that are possible.

Red | Green | Blue | Color | Sample | HTML
--- | --- | --- | --- | --- | ---
0 | 0 | 0 | Black | ■ | 000000
65535 | 65535 | 65535 | White | ■ | FFFFFF
15000 | 15000 | 15000 | Dark Gray | ■ | 3A3A3A
45000 | 45000 | 45000 | Light Gray | ■ | AFAFAF
65535 | 0 | 0 | Red | ■ | FF0000
0 | 65535 | 0 | Green | ■ | 00FF00
0 | 0 | 65535 | Blue | ■ | 0000FF
65535 | 0 | 65535 | Purple | ■ | FF00FF
65535 | 65535 | 0 | Yellow | ■ | FFFF00
0 | 65535 | 65535 | Cyan | ■ | 00FFFF
3441 | 4276 | 32336 | Dark Blue | ■ | 0D107E
39235 | 30211 | 30211 | Brown | ■ | 997676
24367 | 23356 | 31931 | Light Green | ■ | 5F5B7C
65535 | 23356 | 2936 | Orange | ■ | FF5B0B

#### Using Colors

A color in a field or variable is just a piece of data that describes a color… you can’t actually see the color. However, some advanced form objects allow you to control their color using a color data item, and you can look at or modify the color of any graphic object in a form. See changeobjects and objectinfo( for more information.

You can also change the color of Action menu items. See setprocedureoptions and getprocedureoption( for more information.

#### HSB Color

Another way to specify a color is the HSB, or Hue, Saturation, Brightness system. Like the RGB system, the HSB system uses three numbers from 0 to 65,535 to describe a color. However, the three components have different meanings in this system.

The Hue component specifies where this color falls in the spectrum. If you are familiar with the standard Apple color picker, the Hue would specify the angle of the color from the center of the wheel.

The Saturation component refers to how intense this color is. Is it a very intense deep color, or is it a soft pastel color, or somewhere in between? Again using the standard Apple color picker, the Saturation would specify the distance of the color from the center of the wheel.

The Brightness component refers to how light or dark the color is. Is the color very bright, or is it almost black? This sounds similar to Saturation, but it isn’t. Imagine a blue ball under a white light. As the light gets dimmer, the Hue and Saturation of the color don’t change, but the Brightness does. On the Apple color picker the Brightness is specified by the scroll bar on the bottom.

#### HTML Color

In Panorama, color values are normally created with the rgb(, hsb( or htmlrgb( functions. For example, the color of an action menu item can be set to red like this:

    setprocedureoptions "","Danger Level","MENUCOLOR",rgb( 65535 , 0 , 0 )

Instead of using separate color components you can specify colors using an HTML color specification, like this:

    setprocedureoptions "","Danger Level","MENUCOLOR",htmlrgb("FF0000")

An alternative shortcut is to simply use a text string containing the HTML color, like this:

    setprocedureoptions "","Danger Level","MENUCOLOR","FF0000"

No function is required, Panorama simply automatically recognizes that a color is required and an HTML color specification has been supplied.

#### Alpha (Opacity)

An optional color component is opacity. Opacity can vary from 0 (transparent) to 65535 (completely opaque). Note: Some Panorama components, for example menu items, do not support the alpha component, and are always completely opaque.

See Also

- alpha( -- extracts the alpha (opacity) from a color.
- black( -- returns black as a Panorama color value (see Colors).
- blue( -- extracts the blue intensity from a color.
- brightness( -- extracts the brightness from a color.
- colorwheel -- allows the user to pick a color using the operating systems standard color picker dialog
- formcolor -- changes the background color of the current form.
- getwebcolor( -- calculates an RGB color from a Netscape style web color.
- gray( -- returns a shade of gray as a Panorama color value (see Colors).
- green( -- extracts the green intensity from a color.
- hsb( -- creates a color by combining hue, saturation, and brightness components. See Colors.
- htmlcolor( -- converts a color name into a hex HTML color (RRGGBB format).
- htmlcolorarray( -- generates a text array of HTML colors that gradually transition from one color to another.
- htmlrgb( -- converts text formatted as an HTML color into a Panorama color value (see Colors).
- htmlrgbstr( -- converts a color to text formatted as an HTML color.
- hue( -- extracts the hue from a color.
- info("colornames") -- returns a list of color names that can be used as a text object background and with the htmlcolor( function.
- info("formcolor") -- returns the background color of the current form.
- red( -- extracts the red intensity from a color.
- rgb( -- creates a color by combining red, green, and blue primary colors. See Colors.
- rgbstr( -- converts a color into text in the format *red,green,blue*.
- saturation( -- extracts the saturation from a color.
- white( -- returns white as a Panorama color value (see Colors).

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now includes an optional alpha (opacity) component, as well as automatic recognition of HTML colors without a function.