Click any ball to view the corresponding colour palette.
A = alpha channel that measures opacity. 0 = 100% transparent, 255 = 100%
opaque.
R = red channel that measures redness. 0 = black, 255 = intense red.
G = green channel that measures greenness. 0 = black, 255 = intense green.
B = blue channel that measures blueness. 0 = black, 255 = intense blue.
So 0.0.0.0 would be a totally transparent black colour, and 255.255.255.255 would be a totally opaque white. I have discovered by experiment that if you want transparent backgrounds that you can save variable tranparency png files if you use this magic combination:
It is bit like mixing poster paint in grade two art class, except that you are mixing light not pigments, so red + green = yellow (surprise); green + blue = cyan (turquoise); and blue + red = violet.
To make a colour more yellowy you increase the red and green simultaneously and reduce the blue. Do make it darker decrease all three numbers.
The color mixing rules for pigments and light have little to do with physics and a lot to with anatomy and the variable sensitivity of different cells on your retina to different frequencies of light. Other species presumably would have different rules.
You can experiment with colours by looking at the various color charts above or using the Java FontShower which shows Java fonts in various foreground and background colours.
I find the HSB system is easier to work with than RGB. Normally I want a darker shade of the same colour, or a not so circus-bright intensity version of the same colour, or I want the saturation and brightness the same, but a slightly different hue. The FontShower for Swing Applet will let you select in HSB co-ordinates and convert to RGB for use in Java or HTML. The “right” colour is subjective. You have to try a colour and live with it in context a while so see if it is right.
Unfortunately, the colour balance on my faithful Sony monitor is shot and I don’t have the money for a new one. This effectively makes me colour blind. That may explain some of the unusual colour choices on this website.
// paint background g.setColor( getBackground() ); g.fillRect( 0, 0, width, height ); // paint foreground g.setColor( getForeground() ); g.drawString( "hello", x, y );
To make your app blend with other applications, you can use the SystemColor class to select your colours. That way your app will adapt to the Look & Feel and possibly the desktop theme colours. In JDK 1.3-, the colours had lower case names such as Color. white. Since these are static final constants, in JDK 1.4+, Sun gave them proper upper case names such as Color.WHITE. However, beware of using the upper case names it you want to target JDK 1.3- versions. Your programs will explode in a glory of exceptions from the missing support. The lower case names will work in any JDK version.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.58] | |||
| You are visitor number 38,053. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/jgloss/colour.html | J:\mindprod\jgloss\colour.html | ||