Back Home Table of Contents

Color Resolution Engine

The Color Resolution Engine (or CRE) is a powerful expression evaluator that turns text you type into a color. It allows you to specify a color in any number of formats, grab colors specific to your system, and combine colors with expressions.

Accessing the Color Resolution Engine

The easiest way to access the Color Resolution Engine is to use the "Evaluator" selector in the NPS Color Picker dialog, or using the Quick Evaluator accessible by right-clicking on the drawing colors in the main window. You can type a color expression or paste it in from another program using the Ctrl+V keyboard shortcut.

The Color Resolution Engine is also used in color schemes (to enable them to match your system colors) and color swatch palettes.

Basic color formats

You can enter a color using various standardized formats including the following. You can also use the Color Picker to convert the current color to each of these formats in order to copy it into other programs.

Named colors

Enter a named HTML color such as White, Red, or Gainsboro.

HTML RGB color

Enter a color in HTML format such as #FF0000 or the shorthand #F00.

CSS3 RGB(A) and HSL(A)

Enter a color in CSS3-compatible format such as rgb(255,0,0) or hsl(0,100%,50%). You can also specify an alpha channel for transparency by using a floating-point number between 0 and 1, such as rgba(0,128,0,0.5) or hsla(120,100%,25%,0.5).

CSS4 HWB

This is part of the CSS4 draft. Specify a color via its hue and the amount of blackness and whiteness (0 to 100) to mix with it, for example hwb(120,0,50). Note that the CSS4 draft is subject to change and NPS Image Editor may change in the future to better fit the standard. You can use the HWB mixer to visualize this better.

Gray

Specify a grayscale color with a value from 0 to 255 such as gray(128), a percentage such as gray(50%), or a value from 0 to 1 such as gray(0.75).

ARGB and RGB

Specify a color in (A)RGB format with each component ranging from 0 to 255, such as argb(192,0,128,0) or rgb(0,128,255).

RGB Triplets

Specify a color in red/green/blue format as a set of triplets, such as 255 255 0.

HSV and HSL

Specify a color in HSV or HSL format. Hue is specified from 0 to 360 and saturation/value/lightness are specified from 0 to 255. For example hsv(300,255,255) or hsl(300,255,128).

CMY and CMYK

Specify a color in CMY (cyan, magenta, yellow) or CMYK (cyan, magenta, yellow, key) format with each component from 0 to 255. The difference between the two is whether black is mixed with the components or separated out into its own component. For example cmy(100,50,100) or cmyk(50,0,50,50).

YUV

Specify a color in YUV format. Each component ranges from 16 to 235. For example yuv(16,16,16) is a dark green.

Win32/OLE

Specify a color in Win32 integer format

Android

Specify a color in Android integer format

System colors

Specify a system color from your system's current theme. Note that starting in Windows Vista these colors are largely unaffected by the theme settings but can still be modified in the registry.

Classic Windows colors are: ActiveBorder, ActiveCaption, ActiveCaptionText, AppWorkspace, ButtonFace, ButtonHighlight, ButtonShadow, Control, ControlDark, ControlDarkDark, ControlLight, ControlLightLight, ControlText, Desktop, GrayText, GradientActiveCaption, GradientInactiveCaption, Highlight, HighlightText, HotTrack, InactiveBorder, InactiveCaption, InactiveCaptionText, Info, InfoText, Menu, MenuBar, MenuHighlight, MenuText, ScrollBar, Window, WindowFrame, WindowText

To specify the Windows accent color (starting in Vista), use AeroBase. On older systems this will default to the value of Highlight.

Random

Specify random to choose a random color. This will change every time the expression is evaluated.

Color functions

Colors can be manipulated using various functions. Specify colors using any of the above formats, or nest multiple expressions together.

alpha(alpha,color)

Sets the alpha channel of color. For example, you can make a 50% transparent red by specifying alpha(128,red).

blend(color1,color2,[bias])

Blends two colors together. The optional bias value controls how much of color1 vs. color2. A bias value of 0 chooses the second color and 255 chooses the first.

xphover(color,[pressed])

Calculates the inner hover color for a button in the "Office XP" style. The pressed parameter is a boolean value indicating whether the item is in a "pressed" state. Primarily used for color schemes.

match_hue(color_base,color_hue)

Takes the hue from color_hue and applies it to color_base. Used for colorizing an existing color.

hue_shift(shift_amount,color)

Shifts the hue of color by a shift_amount from 0 to 360.

lighten(lighten_amount,color)

Lightens or darkens color by a lighten_amount from 0 to 255. To darken, specify a negative amount.

invert(color)

Inverts the specified color in the RGB color space. For example invert(red) becomes cyan.

To invert the lightness of the color, combine this with the match_hue expression with the original color or build an expression that calos invert twice with manipulations in the middle. For example match_hue(invert(highlight),highlight) or invert(xphover(invert(highlight))).

readable(color)

Finds the most-readable foreground color (black or white) given the background color. For example readable(aliceblue) becomes black and readable(#333) becomes white.