Don't use too many colors. |
It becomes very difficult to administer them. |
Name all colors immediately. |
Giving each new color a name already in the design phase makes it easier to avoid creating unnecessary colors, and to keep track of them. Naming colors initially also makes it easy to consider the purpose of every color. |
Never name a color by its color. |
The names you give your colors should not contain any color names themselves. Suppose you name the background color of your page lightYellowBG and assign the value #FFDDAB to it. This works well only until someone adds dark mode, changing the color value to #030303 , so now your lightYellowBG color represents a very dark gray tone which is confusing! |
Use functional color names. |
Let the color name indicate how the color will be used. F.x. text colors for warning messages could be named colWarnFG . |
Prefix all color named with col. |
This makes it easy to identify color names. Example: colLoginBG . |
Postfix foreground colors with FG. |
This minimizes confusion and makes it possible to automatically check contrast. Example: colLoginFG . |
Postfix background colors with BG. |
This minimizes confusion and makes it possible to automatically check contrast. Example: colLoginBG . |
Only vary the postfix part of colors that should contrast each other. |
If you know that one color is always supposed to be used above another color, just vary the end of the name, to maintain readability and allow contrast to be verified programmatically. Typical example is the above GB and FG variants. |
Prefix color style names with sty. |
This makes it easy to quickly change color styles in a large project. Example: styPageHeader01 . |
Don't reuse colors with different functions. |
Even if color values are the same, but are used for different purposes, a color should be defined for each purpose. |
Don't use short-lived names. |
Color names shall be considered useful throughout the entire life cycle of the app. |
Make groups obvious. |
Suppose you draw a tree with leaves having different nuances of green, you should use the same name for each color, only varying the nuance part, to make it clear they are closely related. Example: colLeaf01 , colLeaf02 and so on. |