This chapter provides information about the UI color list by discussing the following topics:
UI Color Constants
UI Color Functions and Macros
The header file UIColor.h
declares the API that this chapter describes. For more information on the color list, see "Modifying the UI Color List".
UI Color Constants
UIColorTableEntries Typedef
Purpose
Declares symbolic color constants for the various UI elements.
Declared In
UIColor.h
Prototype
typedef Enum8 UIColorTableEntries
Constants
-
UIObjectFrame = 0
- Color for the border of user interface elements (such as command buttons, push buttons, selector triggers, menus, check boxes, and other controls).
-
UIObjectFill
- The background color for a solid or "filled" user interface element.
- Note that UI elements in tables use the
UIField
... colors instead of theUIObject
... colors. -
UIObjectForeground
- The color for foreground items (such as labels or graphics) in a user interface element.
-
UIObjectSelectedFill
- The background color of the currently selected user interface element, whether that element is solid or not.
-
UIObjectSelectedForeground
- The color of foreground items in a selected user interface element.
-
UIMenuFrame
- The color of the border around the menu.
-
UIMenuFill
- The background color of a menu item.
-
UIMenuForeground
- The color of the menu's text.
-
UIMenuSelectedFill
- The background color of a selected menu item.
-
UIMenuSelectedForeground
- The color of the text of a selected menu item.
-
UIFieldBackground
- The background color of an editable text field.
-
UIFieldText
- The color of the text in the editable field.
-
UIFieldTextLines
- The color of underlines in an editable field.
-
UIFieldCaret
- The color of the cursor in an editable text field.
-
UIFieldTextHighlightBackground
- The background color for selected text in an editable text field.
-
UIFieldTextHighlightForeground
- The color of the selected text in an editable text field.
-
UIFieldFepRawText
- Color used for unconverted text in the inline conversion area when a FEP is used as a text input method (for example, on Japanese devices).
- If the FEP colors are identical to field colors, unconverted text has a solid underline.
-
UIFieldFepRawBackground
- The background color for unconverted text in the inline conversion area when a FEP is used as a text input method.
- If the FEP colors are identical to field colors, unconverted text has a solid underline.
-
UIFieldFepConvertedText
- Color used for converted text in the inline conversion area when a FEP is used as a text input method (for example, on Japanese devices).
- If the FEP colors are identical to field colors, converted text has a double-thick underline.
-
UIFieldFepConvertedBackground
- The background color used for converted text in the inline conversion area.
- If the FEP colors are identical to field colors, converted text has a double-thick underline.
-
UIFieldFepUnderline
- The color used for underlines beneath unconverted text in the inline conversion area.
-
UIFormFrame
- The color of the border and title bar on a form.
-
UIFormFill
- The background color of a form. White is recommended for this value.
-
UIDialogFrame
- The color of a border and title bar on a modal form.
-
UIDialogFill
- The background color of a modal form.
-
UIAlertFrame
- The color of the border and title bar on an alert panel.
-
UIAlertFill
- The background color of an alert panel.
-
UIOK
- Not used.
-
UICaution
- Not used.
-
UIWarning
- Not used.
-
UILastColorTableEntry
- Placeholder to indicate end of enum.
Comments
Do not confuse the UI color list with the system color table. The system color table (or system palette) was used in earlier Palm OS® releases to define all available colors for the display or draw window, whether they are in use or not. The UI color list defines the colors used to draw the interface elements.
UI Color Functions and Macros
UIColorGetTableEntryIndex Function
Purpose
Returns the index value for a UI color for the current system palette.
Declared In
UIColor.h
Prototype
IndexedColorType UIColorGetTableEntryIndex (
UIColorTableEntries which
)
Parameters
-
→ which
- One of the symbolic color constants. See
UIColorTableEntries
.
Returns
The system color table index of the color used for the specified symbolic color.
Comments
Because Palm OS Cobalt supports direct color displays rather than indexed color displays, UIColorGetTableEntryRGB()
is more efficient.
See Also
IndexedColorType
, WinIndexToRGB()
UIColorGetTableEntryRGB Function
Purpose
Return the RGB value for the UI color.
Declared In
UIColor.h
Prototype
void UIColorGetTableEntryRGB ( UIColorTableEntrieswhich
, RGBColorType*rgbP
)
Parameters
-
→
which
- One of the symbolic color constants. See
UIColorTableEntries
. -
← rgbP
- Pointer to an RGB color value corresponding to the current color used for the symbolic color. (See
RGBColorType
.)
Returns
Example
The following code shows how to loop through the UI color table and store a list of all colors used (excluding duplicates):
RGBColorType colorsUsed[UILastColorTableEntry]; RGBColorType currentColor; uint16_t i, j, numColors = 0; Boolean isNew ; ... for (i = 0; i < UILastColorTableEntry; i++) { isNew = true; currentColor = UIColorGetTableEntryIndex(i); for (j = 0; ((j < numColors) && isNew); j++) if (colorsUsed[j] == currentColor) isNew = false; /* exit loop */ if (isNew) { numColors++; colorsUsed[j] = currentColor; } }
See Also
UIColorGetTableEntryIndex()
, WinRGBToIndex()
UIColorSetTableEntry Function
Purpose
Change a value in the UI color list.
Declared In
UIColor.h
Prototype
status_t UIColorSetTableEntry ( UIColorTableEntrieswhich
, const RGBColorType*rgbP
)
Parameters
-
→
which
- One of the symbolic color constants. See
UIColorTableEntries
. -
→
rgbP
- The RGB value of the color that should be used for the specified UI element. (See
RGBColorType
.)
Returns
Comments
Sets the value of a UI color entry to the passed RGB value. Updates the index for that UI color entry to the current best fit for that RGB value according to the palette used by the current draw window.
It is best to use this function only if the draw window is currently on-screen. Otherwise, the best-fit algorithm may choose a color that is not available on the current screen.
See Also
WinIndexToRGB()
, UIColorGetTableEntryIndex()
, UIColorGetTableEntryRGB()