NetXP Color Tables

Introduction

The color tables in NetXP are used by renderers such as the Office 2003 renderer and by task panes in order to determine what XP-style colors they should use based on the current Windows XP theme. A color table in NetXP basically consists of a publicly accessible collection of System.Drawing.Color instances. Color tables must implement the IColorTable interface defined in NETXP.Library.dll.

Predefined Color Tables

NetXP also provides built-in color tables for various XP themes. These can all be found in the NETXP.Library.ColorTables class, as static (shared) properties called Classic, Dynamic, XPBlue, XPOlive, and XPSilver. These are readily usable from your own programs.

The Classic color table specifies colors used either when the Windows Classic theme is being used, when the program is being run without theme support, or when a theme is being used that is recognized as neither XPBlue, XPOlive, nor XPSilver. The Classic color table is computed from the system colors each time its Colors collection is referenced. Thus, you should cache the Colors collection to avoid slowdowns.

The Dynamic color table specifies the colors that should used depending on the current Windows visual style. If the style is classic, not themed, or having a theme other than Luna, the Dynamic color table returns colors from the Classic color table. Otherwise, it returns the colors from either XPBlue, XPOlive, or XPSilver, depending on the currently selected theme. This is the best color table to use when you want your program to be fully color-agnostic.

The IColorTable Interface

When creating a custom color table, you have to declare a class that implements the IColorTable interface. This means it must contain a Colors property which is of the type ColorCollection. Within the get accessor, you should instantiate a new color collection and populate it with the necessary colors.

TableColor Enumeration

Each color, depending on its index, has a certain usage. This is mapped using the TableColor enumeration. Each index corresponds to an entry in the TableColor enumeration. You can use this enumeration to access a specific color within a color table.

Below are given the indices in the color collection to which each member in the TableColor enumeration corresponds:

0  TaskPaneStart
1  TaskPaneEnd
2  SystemTaskHeaderStart
3  SystemTaskHeaderEnd
4  SystemTaskHeaderTextNormal
5  SystemTaskHeaderTextHover
6  SystemTaskBoxFill
7  SystemTaskBoxBorder
8  SystemTaskButtonColor
9  NormalTaskHeaderStart
10 NormalTaskHeaderEnd
11 NormalTaskHeaderTextNormal
12 NormalTaskHeaderTextHover
13 NormalTaskBoxFill
14 NormalTaskBoxBorder
15 NormalTaskButtonColor
16 LinkColorNormal
17 LinkColorHover
18 RebarGradientStart
19 RebarGradientEnd
20 ToolbarGradientStart
21 ToolbarGradientEnd
22 ToolbarBottom
23 GripperDark
24 GripperLight
25 ToolbarButtonBorder
26 ToolbarButtonToggledGradientStart
27 ToolbarButtonToggledGradientEnd
28 ToolbarButtonPressedGradientStart
29 ToolbarButtonPressedGradientEnd
30 ToolbarButtonHoverGradientStart
31 ToolbarButtonHoverGradientEnd
32 PopupMenuBackground
33 PopupMenuBorder
34 MenuBarItemGradientStart
35 MenuBarItemGradientEnd
36 PopupMenuItemUncommonGradientStart
37 PopupMenuItemUncommonGradientEnd
38 PopupMenuItemCommonGradientStart
39 PopupMenuItemCommonGradientEnd
40 PopupMenuItemSelected
41 PopupMenuItemChecked
42 PopupMenuItemCheckedHover
43 Separator

Now, the color represented by each of the members, shown under Windows XP Luna (Blue) visual style:

Color Name Usage Sample
TaskPaneStart
TaskPaneEnd
SystemTaskHeaderStart
SystemTaskHeaderEnd (See above)
SystemTaskHeaderTextNormal
SystemTaskHeaderTextHover
SystemTaskBoxFill
SystemTaskBoxBorder
SystemTaskButtonColor
NormalTaskHeaderStart See SystemTask... but for task pane groups of this type:

NormalTaskHeaderEnd (See above note)
NormalTaskHeaderTextNormal (See above note)
NormalTaskHeaderTextHover (See above note)
NormalTaskBoxFill (See above note)
NormalTaskBoxBorder (See above note)
NormalTaskButtonColor (See above note)
LinkColorNormal
LinkColorHover (See above)
RebarGradientStart
RebarGradientEnd (See above)
ToolbarGradientStart
ToolbarGradientEnd (See above)
ToolbarBottom (See above)
GripperDark
GripperLight (See above)
ToolbarButtonBorder

(Border surrounding the above buttons)

ToolbarButtonToggledGradientStart (See above diagram)
ToolbarButtonToggledGradientEnd (See above diagram)
ToolbarButtonPressedGradientStart (See above diagram)
ToolbarButtonPressedGradientEnd (See above diagram)
ToolbarButtonHoverGradientStart (See above diagram)
ToolbarButtonHoverGradientEnd (See above diagram)
PopupMenuBackground
PopupMenuBorder (See above diagram)
MenuBarItemGradientStart
MenuBarItemGradientEnd (See above diagram)
PopupMenuItemUncommonGradientStart
PopupMenuItemUncommonGradientEnd (See above diagram)
PopupMenuItemCommonGradientStart (See above diagram)
PopupMenuItemCommonGradientEnd (See above diagram)
PopupMenuItemSelected (See above diagram)
PopupMenuItemChecked (See above diagram)
PopupMenuItemCheckedHover (See above diagram)
Separator (See above diagram)