Log In    |    Knowledge Base    |    4D Home
Tech Tip: Applying Colors Based on Names
Published On: April 18, 2022

Many of 4D’s features use and apply styles from CSS formatting and standards. One of these properties is colors. When applying a color to one or more widgets using the OBJECT SET RGB COLORS command, there are various ways to define a color.

Usually the color would be defined using the RGB hex code, but that can be a bit difficult to read. An alternative is to use the colors’ names. HTML CSS support various named colors that as associated with a specific RGB value.

If a standard color is used, the name can be used to make reading the code easier, or even writing the code. If the name is used, there is not a need to break away and look up the RGB values.

For example with grey vs it's RGB Hex code of #808080. It is probably easier to remember grey over its code.

OBJECT SET RGB COLORS(*;"formObject";"#808080")

is the same as

OBJECT SET RGB COLORS(*;"formObject";"grey")

The following link is a page that lists named color codes: