|
|
Well-known colors can be defined in terms of their (R, G, B) components. A short list of the more common colors is provided below.
Blue = 0, 0, 255 Green = 0, 255, 0 Magenta = 255, 0, 255 Orange = 255, 200, 0 Pink = 255, 175, 175 Red = 255, 0, 0 Yellow = 255, 255, 0 LightGray = 192, 192, 192 DarkGray = 64, 64, 64 Gray = 128, 128, 128 Black = 0, 0, 0 White = 255, 255, 255
Your code will be more intuitive if you use the well-known name for a color instead of its corresponding hexadecimal value. However, the vast majority of colors do not have a well-known name, which means that you have no choice but to use the non-intuitive representation of the color in question. Regardless of the method you use for specifying colors, SVG enables you to easily create rich visual images with subtle shading effects.
In order to illustrate the techniques for specifying color, the following four SVG code fragments demonstrate four different ways of rendering a blue rectangle with the SVG rect element:
<rect width="200" height="100" fill="rgb(0,0,255)"/> <rect width="200" height="100" fill="rgb(0%,0%,100%)"/> <rect width="200" height="100" fill="blue"/> <rect width="200" height="100" fill="blue"/>
|
|