Static and dynamic color values.
SRP understands the importance of a consistent interface, and color plays a large role in achieving an interface that appears to belong in its environment. SRP designed Color properties to easily establish a variety of color related effects using a single property value.
Static Color Value
A color property accepts static color values in three ways: as a single integer value, as RGB components, or as HSL components. The integer value can be calculated using the following formula:
IntegerVal = (B * 65536) + (G * 256) + R
To set the color to RGB components, use the format:
RGB(R,G,B)
The RGB keyword tells the property to treat the input as RGB components. If you omit the RGB keyword and use only the braces, then RGB is assumed. However, the braces cannot be omitted, since the input will then be treated as a single integer value. The advantage to the RGB component format is that the property calculates the color for you.
To set the color to HSL components, use the format:
HSL(H,S,L)
HSL is similar to RGB in that is calculate a color, but HSL components have different meaning. The H component is Hue, which is any of 255 base colors. There is generally no way to interpret what color this component might represent, but you can use MS Paint's Color Palette window to determine the value of a hue you're interested in. Why use HSL then? Because you may want to guarantee that any color be of a certain darkness or grayness. This is where the other two components come in. The S component is Saturation, or the purity of the color. When saturation is 255, then the hue is at it's purest, while a saturation level of 0 is pure gray. Any value in between is a blend of the hue with a corresponding amount of gray. The final component, L, is Luminance. A value of 255 for luminance results in pure white, while a value of 0 results in pure black. Any value in between results in a brighter or darker version of the color.
To complete the explanation of static colors, here are four ways of setting the Color property to bright blue:
Color = 16711680 ;* Single Integer Color = 255 * 65536 ;* Expression Evaluation into a Single Integer Color = "RGB(0, 0, 255)" ;* RGB Components Color = "HSL(160, 255, 127)" ;* HSL Components
Regardless of how a static color is set, the color is always returned in RGB(R,G,B) format.
System Color
Sometimes you may want your OLE control to blend in with the end user's current desktop theme colors. Therefore, Color properties accept system color names, so even if the end user changes his/her desktop theme colors, the OLE control will dynamically change to match. Acceptable system color names and their abbreviations are:
Name | Abbr. | Description |
---|---|---|
3DFace | 3D | Face color for 3D display elements. |
3DLight | 3DL | Light color for 3D display elements (for edges facing the light source). |
3DHilight | 3DH | Highlight color for 3D display elements (for edges facing the light source). |
3DShadow | 3DS | Shadow color for 3D display elements (for edges facing away from the light source). |
3DDkShadow | 3DDK | Dark shadow color for 3D display elements (for edges facing away from the light source). |
3DText | 3DT | Text color for 3D display elements. |
ActiveTitle | AT | Active window's title bar. |
ActiveTitle1 | AT1 | Same as ActiveTitle. |
ActiveTitle2 | AT2 | Right side color in the color gradient of an active window's title bar. Same as ActiveTitle if no gradient theme is set. |
ActiveTitleText | ATT | Active window's title bar text. |
ActiveWindowBorder | AWB | Active window's border. |
AppBackground | ABK | Background color of multiple document interface (MDI) applications. |
Desktop | DT | Desktop background color. |
GrayText | GT | Grayed (disabled) text. |
HotItem | HOT | Color for a hot-tracked item. |
InactiveTitle | IT | Inactive window's title bar. |
InactiveTitle1 | IT1 | Same as InactiveTitle. |
InactiveTitle2 | IT2 | Right side color in the color gradient of an inactive window's title bar. Same as "InactiveTitle" if no gradient theme is set. |
InactiveTitleText | ITT | Inactive window's title bar text. |
InactiveWindowBorder | IWB | Inactive window's border. |
Menu | M | Menu background. |
MenuText | MT | Text in menus. |
ScrollBar | SB | Scroll bar gray area. |
Select | S | Item(s) selected in a control. |
SelectText | ST | Text of item(s) selected in a control. |
ToolTip | TT | Background color for tool tip controls. |
ToolTipText | TTT | Text color for tool tip controls. |
Window | W | Window background. |
WindowFrame | WF | Window frame. |
WindowText | WT | Text in windows. |
Color properties are not case-sensitive, so these names are accepted regardless of their case.
Office Colors
In addition to specifying standard system colors by name, you can also specify MS Office theme colors. These colors are used within Office XP and Office 2003.
Name | Abbr. | Description |
---|---|---|
Office3DFace | O3D | XP face color for three- dimensional display elements and for dialog box backgrounds. |
Office3DShadow | O3DS | XP shadow color for three-dimensional display elements (for edges facing away from the light source). |
OfficeCheckedText | OCT | XP color for text displayed in a checked button. |
OfficeDisabled | OD | XP menu icon disabled color. |
OfficeEditBorder | OEB | XP color for the border color of edit controls. |
OfficeFrame | OF | Office 2003 frame color. |
OfficeGrayText | OGT | XP menu item disabled text color. |
OfficeIconShadow | OIS | XP menu item icon shadow. |
OfficeLabel | OL | XP label control color. |
OfficeMenu | OM | XP menu item text background color. |
OfficeMenuBorder | OMB | XP menu border color. |
OfficeMenuExpanded | OME | XP hidden menu commands background color. |
OfficeMenuText | OMT | XP menu item text color. |
OfficePushedText | OPT | XP toolbar pushed text color. |
OfficeSelect | OS | XP menu item selected color. |
OfficeSelectBorder | OSB | XP menu item selected border color. |
OfficeSelectChecked | OSC | XP menu item checked color. |
OfficeSelectCheckedBorder | OSCB | XP menu item checked border color. |
OfficeSelectPushed | OSP | XP menu item pushed color. |
OfficeSelectPushedBorder | OSPB | XP border color for pushed in 3D elements. |
OfficeSelectText | OST | XP menu item selected text color. |
OfficeSeparator | OSEP | XP toolbar separator color. |
OfficeSplitter | OSPL | XP splitter face color. |
OfficeStaticFrame | OSF | WinXP Static frame color |
OfficeTabInactive | OTI | XP inactive tab background color. |
OfficeTabInactiveText | OTIT | XP inactive tab text color. |
OfficeToolbar | OTB | XP toolbar background color. |
OfficeToolbarGripper | OTBG | XP toolbar gripper color. |
OfficeToolbarText | OTBT | XP toolbar text color. |
HTML Colors
As an added convenience, you may specify any standard HTML color name. The currently available colors are listed below:
Color Name | Color |
---|---|
AliceBlue | |
AntiqueWhite | |
Aqua | |
Aquamarine | |
Azure | |
Beige | |
Bisque | |
Black | |
BlanchedAlmond | |
Blue | |
BlueViolet | |
Brown | |
BurlyWood | |
CadetBlue | |
Chartreuse | |
Chocolate | |
Coral | |
CornflowerBlue | |
Cornsilk | |
Crimson | |
Cyan | |
DarkBlue | |
DarkCyan | |
DarkGoldenRod | |
DarkGray | |
DarkGrey | |
DarkGreen | |
DarkKhaki | |
DarkMagenta | |
DarkOliveGreen | |
DarkOrange | |
DarkOrchid | |
DarkRed | |
DarkSalmon | |
DarkSeaGreen | |
DarkSlateBlue | |
DarkSlateGray | |
DarkSlateGrey | |
DarkTurquoise | |
DarkViolet | |
DeepPink | |
DeepSkyBlue | |
DimGray | |
DimGrey | |
DodgerBlue | |
FireBrick | |
FloralWhite | |
ForestGreen | |
Fuchsia | |
Gainsboro | |
GhostWhite | |
Gold | |
GoldenRod | |
Gray | |
Grey | |
Green | |
GreenYellow | |
HoneyDew | |
HotPink | |
IndianRed | |
Indigo | |
Ivory | |
Khaki | |
Lavender | |
LavenderBlush | |
LawnGreen | |
LemonChiffon | |
LightBlue | |
LightCoral | |
LightCyan | |
LightGoldenRodYellow | |
LightGray | |
LightGrey | |
LightGreen | |
LightPink | |
LightSalmon | |
LightSeaGreen | |
LightSkyBlue | |
LightSlateGray | |
LightSlateGrey | |
LightSteelBlue | |
LightYellow | |
Lime | |
LimeGreen | |
Linen | |
Magenta | |
Maroon | |
MediumAquaMarine | |
MediumBlue | |
MediumOrchid | |
MediumPurple | |
MediumSeaGreen | |
MediumSlateBlue | |
MediumSpringGreen | |
MediumTurquoise | |
MediumVioletRed | |
MidnightBlue | |
MintCream | |
MistyRose | |
Moccasin | |
NavajoWhite | |
Navy | |
OldLace | |
Olive | |
OliveDrab | |
Orange | |
OrangeRed | |
Orchid | |
PaleGoldenRod | |
PaleGreen | |
PaleTurquoise | |
PaleVioletRed | |
PapayaWhip | |
PeachPuff | |
Peru | |
Pink | |
Plum | |
PowderBlue | |
Purple | |
Red | |
RosyBrown | |
RoyalBlue | |
SaddleBrown | |
Salmon | |
SandyBrown | |
SeaGreen | |
SeaShell | |
Sienna | |
Silver | |
SkyBlue | |
SlateBlue | |
SlateGray | |
SlateGrey | |
Snow | |
SpringGreen | |
SteelBlue | |
Tan | |
Teal | |
Thistle | |
Tomato | |
Turquoise | |
Wheat | |
White | |
Yellow | |
WhiteSmoke | |
YellowGreen |
Color Modifiers
System and HTML colors are great for basic look and feel, but you may want to only use these predefined colors as a base while still having the flexibility to achieve the look and feel you desire without sacrificing conformity to these colors. For instance, you may want to use the system highlight color for selected cells in the SRP OLE EditTable, but you may also want it to always be light enough to display black text in front of it. Color modifiers provide the means to achieve this and other effects. The color modifier format is:
ColorName Modifier=Value
ColorName is one of the system or HTML color names listed above. Modifier is one of the available single-character modifiers listed below. Value is a number indicating the modifier's new value to be applied to the system color. The available modifiers are:
Modifier | Value | Description |
---|---|---|
L | 0 - 100 | Luminance modifier. Luminance is a measurement of light applied to the color. 0 is darkest (black) and 100 is lightest (white). |
S | 0 - 100 | Saturation modifier. Saturation is a measurement of purity applied to the color. 0 is pure grey and 100 is the pure color. |
C | n/a | Compliment modifier. Modifies the predefined color to be its complimentary color. Always applied first. |
G | n/a | Grayscale modifier. Modifies the predefined color to be grayscale. This is more accurate than setting S=0. Always applied last. |
Here is a side-by-side comparison of a single system color modified using the available modifiers:
Here are the same values as above but with the grayscale modifier applied.
Any modifier that can be set to a value, such as the Luminance modifier, can be set to a relative value as well. Do this by using the += or the -= operators. The += operator increases the attribute while the -= decreases it. Let's use Luminance as an example:
For convenience, color modifiers can also be applied to Static colors as well.
Auto Values
Color properties can also receive three other string values: "Auto", "None", and "Transparent". The "Auto" value sets the color property to its default value, which is decided by the OLE control. The "None" value is accepted by some Color properties to specify no color. The results of these values depend on the OLE control's implementation.
The "Transparent" value is similar to "None" in that it represents no color, however, while "None" will be interpreted by some controls as don't-draw-anything, "Transparent" will be interpreted as draw something invisible. For example, when using swatches in the Tree control, "None" means no swatch whereas "Transparent" means an invisible swatch. This is useful for making sure tree items still line up but leaving empty spaces for items with no swatch.
Additionally, The Color Fill technology can accept "Transparent" as one of the colors in a gradient, thus allowing you to fade a color into nothing for some interesting effects.
In all cases unrecognized or Null values are treated as "Auto" values.