Standard ways to assign color values

Contents


Standard HTML Color names

Use these in a document via the style color:color_name

Color NameExampleHex Equivalent
BlackBlack#000000
SilverSilver#C0C0C0
GrayGray#808080
WhiteWhite#FFFFFF
MaroonMaroon#800000
RedRed#FF0000
PurplePurple#800080
FuchsiaFuchsia#FF00FF
GreenGreen#008000
LimeLime#00FF00
OliveOlive#808000
YellowYellow#FFFF00
NavyNavy#000080
BlueBlue#0000FF
TealTeal#008080
AquaAqua#00FFFF

User preferences for colors

CSS2 allows authors to specify various UI elements colors as colors in their styles; e.g., color:ActiveBorder. Here are examples:

ExampleConstantDescription
ActiveBorderActiveBorder(active window border)
ActiveCaptionActiveCaption(active window caption)
AppWorkspaceAppWorkspace(background color of multiple document interface)
BackgroundBackground(desktop background)
ButtonFaceButtonFace(face color for 3-d display elements)
ButtonHighlightButtonHighlight(dark shadow for 3-d display elements for edges facing away from the light source)
ButtonShadowButtonShadow(shadow clor for 3-d display elements)
ButtonTextButtonText(text on push buttons)
CaptionTextCaptionText(text in caption, size box, and scrollbar arrow box)
GrayTextGrayText(disabled text)
HighlightHighlight(item(s) selected in a control)
HighlightTextHighlightText(text of items selected in a control)
InactiveBorderInactiveBorder(inactive window border)
InactiveCaptionInactiveCaption(inactive window caption)
InactiveCaptionTextInactiveCaptionText(color of text in inactive caption)
InfoBackgroundInfoBackground(background color for tooltip controls)
InfoTextInfoText(text color for tooltip controls)
MenuMenu(menu background)
MenuTextMenuText(text in menus)
ScrollbarScrollbar(scroll bar gray area)
ThreeDDarkShadowThreeDDarkShadow(dark shadow for 3-d display elements)
ThreeDFaceThreeDFace(face color for 3-d display elements)
ThreeDHighlightThreeDHighlight(highlight color for 3-d display elements)
ThreeDLightShadowThreeDLightShadow(Light color for 3-d display elements for edges facing the light source)
ThreeDShadowThreeDShadow(dark shadow for 3-d display elements)
WindowWindow(window background)
WindowFrameWindowFrame(window frame)
WindowTextWindowText(window text)

Using Single-Digit HEX RGB Values for Colors

You are allowed to specify Single-Digit HEX RGB values. Try it! You can use any value from 0 to f in each of the three boxes. Note that what happens is that the style processor will automatically double the digits for you. For example, if color:#777 is specified, what gets rendered is color:#777777.

RedGreenBlueOutput
Pack my box with five dozen liquor jugs!

Using Double-Digit HEX RGB Values for Colors

You are allowed to specify Double-Digit HEX RGB values. Try it! You can use any value from 00 to ff in each of the three boxes.

RedGreenBlueOutput
Pack my box with five dozen liquor jugs!

RGB By Percent

You are allowed to specify percent values for RGB. Try it! You can use any value from 0 to 100 in each of the three boxes.

RedGreenBlueOutput
Pack my box with five dozen liquor jugs!

Eight Bit RGB

You are allowed to specify eight-bit values for RGB. Try it! You can use any value from 0 to 255 in each of the three boxes.

RedGreenBlueOutput
Pack my box with five dozen liquor jugs!