Colors

The basic VGA monitor supports 16 colors. These correspond to the basic 16 named colors in Delphi and html. The Windows operating systems all support these colors.

Visual Basic | Delphi | C++ Builder | Windows API | html | Java

Visual Basic 6.0

3.0 -   Black    Red    Green    Yellow    Blue    Magenta    Cyan    White
6.0 - vbBlack  vbRed  vbGreen  vbYellow  vbBlue  vbMagenta  vbCyan  vbWhite

    VB 3.0               VB 6.0             Value          Comment
SCROLL_BARS           vbScrollBars           &H80000000  Scroll-bars gray area
DESKTOP               vbDesktop              &H80000001  Desktop
ACTIVE_TITLE_BAR      vbActiveTitleBar       &H80000002  Active window caption
INACTIVE_TITLE_BAR    vbInactiveTitleBar     &H80000003  Inactive window caption
MENU_BAR              vbMenuBar              &H80000004  Menu background
WINDOW_BACKGROUND     vbWindowBackground     &H80000005  Window background
WINDOW_FRAME          vbWindowFrame          &H80000006  Window frame
MENU_TEXT             vbMenuText             &H80000007  Text in menus
WINDOW_TEXT           vbWindowText           &H80000008  Text in windows
TITLE_BAR_TEXT        vbTitleBarText         &H80000009  Text in caption, size box, scroll-bar arrow box
ACTIVE_BORDER         vbActiveBorder         &H8000000A  Active window border
INACTIVE_BORDER       vbInactiveBorder       &H8000000B  Inactive window border
APPLICATION_WORKSPACE vbApplicationWorkspace &H8000000C  Background color of multiple document interface (MDI) applications
HIGHLIGHT             vbHighlight            &H8000000D  Items selected item in a control
HIGHLIGHT_TEXT        vbHighlightText        &H8000000E  Text of item selected in a control
BUTTON_FACE           vbButtonFace           &H8000000F  Face shading on command buttons
BUTTON_SHADOW         vbButtonShadow         &H80000010  Edge shading on command buttons
GRAY_TEXT             vbGrayText             &H80000011  Grayed (disabled) text
                                   '   Set to 0 if the current display driver 
                                   '   does not support a solid gray color
BUTTON_TEXT           vbButtonText           &H80000012  Text on push buttons
                      vbInactiveCaptionText  &H80000013  Color of text in an inactive caption 
                      vb3DHighlight          &H80000014  Highlight color for 3D display elements
                      vb3DDKShadow           &H80000015  Darkest shadow color for 3D display elements 
                      vb3DLight              &H80000016  Second lightest of the 3D colors after vb3Dhighlight 
                      vb3DFace               &H8000000F  Color of text face 
                      vb3Dshadow             &H80000010  Color of text shadow 
                      vbInfoText             &H80000017  Color of text in ToolTips 
                      vbInfoBackground       &H80000018  Background color of ToolTips 

MS Access 97 code is written in Visual Basic for Applications. Though the help files do not give any predefined color constants, the VB 6.0 constants work.

Notice that VisualBasic and html place the colors in different orders.


Delphi

clBlack   clMaroon  clGreen  clOlive   clNavy  clPurple   clTeal  clGray
clSilver  clRed     clLime   clYellow  clBlue  clFuchsia  clAqua  clWhite


C++ Builder


Windows API

Window's default color aliases. The users can re-define the colors associated with these aliases by using the ControlPanel / Display / Appearance tab. Use these if you want your application to blend in with the user defined color scheme. These 25 "colors" are not displayed using their RGB equivalent, system colors are used instead.
Screen Element Value Hex
Scroll bar -2147483648 &H80000000
Desktop -2147483647 &H80000001
Active window title bar -2147483646 &H80000002
Inactive window title bar -2147483645 &H80000003
Menu bar -2147483644 &H80000004
Window -2147483643 &H80000005
Window frame -2147483642 &H80000006
Menu text -2147483641 &H80000007
Window text -2147483640 &H80000008
Title bar text -2147483639 &H80000009
Active window border -2147483638 &H8000000A
Inactive window border -2147483637 &H8000000B
Application background -2147483636 &H8000000C
Highlight -2147483635 &H8000000D
Highlight text -2147483634 &H8000000E
3-D face -2147483633 &H8000000F
3-D shadow -2147483632 &H80000010
Dimmed (disabled) text -2147483631 &H80000011
Button text -2147483630 &H80000012
Inactive window title bar text -2147483629 &H80000013
3-D highlight -2147483628 &H80000014
3-D dark shadow -2147483627 &H80000015
3-D light -2147483626 &H80000016
ToolTip text -2147483625 &H80000017
ToolTip background -2147483624 &H80000018


Html

bgcolor="#c0c0c0"   Normal background gray
bgcolor="#ffffff"   White 
bgcolor="#000000"   Black
bgcolor="#xxyyzz"   xx=red yy=green zz=blue in hex
bgcolor="black"     Black
  Black   Maroon  Green  Olive   Navy  Purple   Teal  Gray
  Silver  Red     Lime   Yellow  Blue  Fuchsia  Aqua  White
Notice that VisualBasic and html place the colors in different orders.


Java

Color objects and constants are defined in awt/Color.java (JDK 1.1).
white lightGray gray darkGray black red pink orange yellow 
green magenta cyan blue
labelid.setBackground(Color.yellow);
Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Languages / Colors.htm