# Color Properties

> Source: https://manual.pvxplus.com/control-object-properties/colour-properties

Some properties are used to define color attributes in various graphical control objects. Some examples are **[BackColor$](https://manual.pvxplus.com/properties/backcolor)**, **[BackHilight1$](https://manual.pvxplus.com/properties/backhilight1)**, **[BorderColor$](https://manual.pvxplus.com/properties/bordercolor)**, **[CurrentCellColor$](https://manual.pvxplus.com/properties/currentcellcolor)**, just to name a few.

To apply a color to these properties, you can specify a color name and number, an RGB value, an HTML Hex code, an HSL value or a color specification in HTML format.

Specifying two colors separated by a **+** (*plus sign*) will blend the colors together. Adding ***\*nnn*** at the end of any color specification will lighten/darken the color.

The **[Properties List](https://manual.pvxplus.com/control-object-properties/properties-list)** provides a complete alphabetically arranged list of ***all*** the various properties available, including color properties.

Note:  
Throughout the system, property names with the word/syllable "color" can also be spelled using the alternate English spelling of "colour".

## Color Names and Numbers

The following table defines the named colors in the system and their respective color numbers:

|  |
| --- |
| \|  \|  \|  \|  \|  \|  \|  \|  \|<br>\| --- \| --- \| --- \| --- \| --- \| --- \| --- \| --- \|<br>\| Black \| **0** \| Light Blue \| **4** \| Dark Gray \| **8** \| Dark Blue \| **12** \|<br>\| Light Red \| **1** \| Light Magenta \| **5** \| Dark Red \| **9** \| Dark Magenta \| **13** \|<br>\| Light Green \| **2** \| Light Cyan \| **6** \| Dark Green \| **10** \| Dark Cyan \| **14** \|<br>\| Light Yellow \| **3** \| White \| **7** \| Dark Yellow \| **11** \| Light Gray \| **15** \| |

If the "Light" or "Dark" clause is omitted from a color name specification, the system will assume "Light" for text/foreground colors and "Dark" for background colors.

Note:  
The color keyword "LIGHT" or "GRAY" may be entered as "LITE" or "GREY" respectively.

## RGB Color Specifications

Wherever a color name/string can be specified, an RGB value can be supplied:

"RGB: *rrr*, *ggg*, *bbb*"

***Where:***

|  |  |
| --- | --- |
| *rrr* | Red intensity in the range of 0 to 255 |
| *ggg* | Green intensity in the range of 0 to 255 |
| *bbb* | Blue intensity in the range of 0 to 255 |

***Example:***

White would be "RGB: 255 255 255", and Orange would be "RGB: 250 165 0".

## HTML Hex Color Codes

Each HTML color code consists of the **#** symbol followed by six letters or numbers in the hexadecimal number system, which represent the Red, Green and Blue components of the color (i.e. #RRGGBB). The first two values represent the intensity of the Red color, the next two values represent the intensity of the Green color, and the last two values represent the intensity of the Blue color. The value 00 is the least intense and FF is the most intense. FF in the hexadecimal system represents the number 255 in decimal form.

***Example:***

This example lists the hexadecimal codes and equivalent decimal codes that produce the colors Red, Green, Blue and Cyan.

| **Color Name** | **Hexadecimal Code (#RRGGBB)** | **Decimal Code (R,G,B)** | **Result** |
| --- | --- | --- | --- |
| Red | #FF0000 | (255,0,0) Maximum of Red, no Green, no Blue | ![](https://manual.pvxplus.com/migration-assets/5d8fb317abedf522fd22b25fb95a5f575414e9235026bc477079cb2fe7f8c69f.png) |
| Green | #00FF00 | (0,255,0) No Red, maximum of Green, no Blue | ![](https://manual.pvxplus.com/migration-assets/5838933ddbe7bb4394f49350c4118f1c0db680a44c9f543be6105e9dccca3791.png) |
| Blue | #0000FF | (0,0,255) No Red, no Green, maximum of Blue | ![](https://manual.pvxplus.com/migration-assets/e52a92a5d01589f300625cde1d2de366f27b1d0b60345a702c2c1494920e2e57.png) |
| Cyan | #00FFFF | (0,255,255) No Red, maximum of Green and Blue | ![](https://manual.pvxplus.com/migration-assets/702cf9d2b582dc348234f9c16d867ca5090d78cf67626c866c605ad5ca06c9ef.png) |

## HTML Named Colors

You can also use any of the 140 standard HTML named colors by prefixing the HTML color name with a **#** symbol.

*(Support for the use of HTML named colors was added in PxPlus 2022.)*

***Example:***

To use the HTML named color Maroon, in your code, you would set the color to:

```
#Maroon (case insensitive)
```

Any invalid name will be considered Default. For information on which colors are supported, visit [https://www.w3schools.com/tags/ref_colornames.asp](https://www.w3schools.com/tags/ref_colornames.asp).

The following table lists all the HTML named colors:

| **Color Name** | **Result** | **Color Name** | **Result** |
| --- | --- | --- | --- |
| #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 |  | #DarkGreen |  |
| #DarkKhaki |  | #DarkMagenta |  |
| #DarkOliveGreen |  | #DarkOrange |  |
| #DarkOrchid |  | #DarkRed |  |
| #DarkSalmon |  | #DarkSeaGreen |  |
| #DarkSlateBlue |  | #DarkSlateGray |  |
| #DarkTurquoise |  | #DarkViolet |  |
| #DeepPink |  | #DeepSkyBlue |  |
| #DimGray |  | #DodgerBlue |  |
| #Firebrick |  | #FloralWhite |  |
| #ForestGreen |  | #Fuchsia |  |
| #Gainsboro |  | #GhostWhite |  |
| #Gold |  | #Goldenrod |  |
| #Gray |  | #Green |  |
| #GreenYellow |  | #Honeydew |  |
| #HotPink |  | #IndianRed |  |
| #Indigo |  | #Ivory |  |
| #Khaki |  | #Lavender |  |
| #LavenderBlush |  | #LawnGreen |  |
| #LemonChiffon |  | #LightBlue |  |
| #LightCoral |  | #LightCyan |  |
| #LightGoldenrodYellow |  | #LightGray |  |
| #LightGreen |  | #LightPink |  |
| #LightSalmon |  | #LightSeaGreen |  |
| #LightSkyBlue |  | #LightSlateGray |  |
| #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 |  |
| #Snow |  | #SpringGreen |  |
| #SteelBlue |  | #Tan |  |
| #Teal |  | #Thistle |  |
| #Tomato |  | #Turquoise |  |
| #Violet |  | #Wheat |  |
| #White |  | #WhiteSmoke |  |
| #Yellow |  | #YellowGreen |  |

## HSL Color Specifications

Wherever a color name/string can be specified, an HSL value can be supplied:

"HSL: *hhh, sss, lll*"

***Where:***

|  |  |
| --- | --- |
| *hhh* | Color hue in the range of 0 to 360 |
| *sss* | Color saturation level as a percentage in the range of 0 to 100 |
| *lll* | Color lightness as a percentage in the range of 0 to 100 |

For a description of how HSL works, visit **[http://en.wikipedia.org/wiki/HSL_and_HSV](http://en.wikipedia.org/wiki/HSL_and_HSV)**.

## Color Blending

If desired, wherever a color specification is needed, you can specify two colors separated by a **+** (*plus sign*), which will cause the system to blend the colors together.

***Example:***

The color specification of …

"LIGHT RED" + "LIGHT YELLOW"

… will result in an Orange color due to the blending of Yellow and Red.

## Dynamic Color Lightening

To create shades of a specified color, you can append ***\*nnn*** at the end of any color specification to cause the system to lighten/darken the color. The value of *nnn* defines the percentage by which the color will be lightened or darkened.

A value of \*100 leaves the color alone, \*120 will brighten the color by 20%, whereas \*80 will darken it 20%.

***Example:***

Running the following program will adjust the lightness of the color BLUE between 50 and 150 percent:

```
for i=50 to 150 step 10
     print 'fill'(1,"BLUE*"+str(i)),'rectangle'(i*5,@y(15),i*5+50,@y(17)),
next
```

This yields the following result:

![](https://manual.pvxplus.com/migration-assets/1da87097383c56f754a637fe218a1f671c76f4e5fd496a2a3f65d41b48a675b4.jpg)

(HSL, Color Blending and Dynamic Color Lightening are available as of PxPlus 2014.)
