SourceForge Logo

Colors for HMI Elements

Color values are handled in a somewhat strange way. The reason is that I strongly prefer the 16 good old EGA colors for HMI pages. I think it will be helpful when porting pages to embedded devices that may not have many colors or cannot display them really different looking, as it is the case with LCD screens. I further think about JAVA enabled mobile phones. I do not have such devices at hand, but I suppose that every color display will show at least the sixteen EGA colors.
From EGA colors, thereis a special exception: Color 3 is normally a darker cyan. I thought that this color is the best to give awy for a blinking one. Now, color code 3 means a color blinking in the rhythm of refresh, alternating between brightest green and orange. I found that this can be seen over great distances. On standard VGA cards, the blinking can be realized by switching the color palette.
However, you can use (nearly) the full 24 bit RGB range also. This works as follows: Color parameters for an hmiElement are handled as numbers for EGA colors, when they are in the range of 0..15. Minus one also has a special meaning: Do not draw. All other values are handled as if represent an RGB triple of 2^16*R+256*G+B. In fact they are simply passed to the java.awt.Color(value) constructor. This means that you loose the very dark blue tones which would correspond to 0..15.