Web Color Scripting

Converting color values
color color color color

Type a color string and press the Enter key, or click the 'Random' button for a random RGB string.

color

Color Values
Name RGB Hex

1. Javascript color strings

Colors on the web are expressed as string values, either as a common color name, or as a triplet of values that signify the amounts of red, green and blue in the color. These are all valid ways to indicate the same color:

hex assignment:
element.style.color='#ff0000';
percentage:
element.style.color='rgb(100%,0,0)';
decimal assignment:
element.style.color='rgb(255,0,0)'
color name:
element.style.color='red'

Browsers understand the strings 'transparent' and 'inherit' as a background-color style property.
This allows the background of the element's containing element to show through. The W3 recommends compliance for a basic set of color names:

aqua____ black____ blue____ fuchsia____ gray____ green____ lime____ maroon____
navy____ olive____ purple____ red____ silver____ teal____ white____ yellow____


Standard Color Names