Click any ball to view the corresponding colour palette.
|Named Colours||Alphabetically (140)||BHS: by Brightness, Hue, Saturation||HBS: by Hue, Brightness, Saturation||SBH: by Saturation, Brightness, Hue||Java AWT Colours (16,777,216)|
|RGB: Numerically (140)||BSH: by Brightness, Saturation, Hue||HSB: by Hue, Saturation, Brightness||SHB: by Saturation, Hue, Brightness||Java Swing Colours (16,777,216)|
|Numbered Colours||HTML 3.2 (16)||Websafe (216)||Rainbow (4096)||Spectrum (401)||X11 (657)|
|Selected Colours||Pale (256)||Dark (2022)||Simple (105)||Greys (256)||Colour Schemes|
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 transparency 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 coordinates 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 (Java Development Kit) 1.3-, the colours had lower case names such as Color. white. Since these are static final constants, in Java version 1.4 or later, 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.
This page is posted
Optional Replicator mirror
Please read the feedback from other visitors, or send your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Your face IP:[184.108.40.206]
You are visitor number|