HTML color codes are used to define colors in web design, usually in the form of a hexadecimal (HEX) code, RGB, or by name. Here’s a breakdown of the most common formats:
1. HEX Codes
- A HEX color code starts with a
#followed by six characters (numbers 0-9 and letters A-F), which represent the intensity of red, green, and blue. - Format:
#RRGGBB - Example:
#FF5733(a shade of orange)
| Color | HEX Code |
|---|---|
| White | #FFFFFF |
| Black | #000000 |
| Red | #FF0000 |
| Green | #00FF00 |
| Blue | #0000FF |
| Yellow | #FFFF00 |
| Cyan | #00FFFF |
| Magenta | #FF00FF |
2. RGB (Red, Green, Blue)
- RGB colors define the intensity of red, green, and blue on a scale of 0-255.
- Format:
rgb(red, green, blue) - Example:
rgb(255, 87, 51)(a shade of orange)
3. RGBA (Red, Green, Blue, Alpha)
- Similar to RGB, but the fourth value (alpha) specifies the opacity of the color.
- Format:
rgba(red, green, blue, alpha) - Example:
rgba(255, 87, 51, 0.5)(50% opacity of the same orange)
4. HTML Color Names
- HTML also supports 140 named colors.
- Example:
red,blue,green,lightgray,darkslateblue
| Color Name | Display |
|---|---|
lightcoral |
|
darkslategray |
|
palegreen |
|
royalblue |
|
These are just a few examples. You can find a complete list of HTML color codes and names in many online color pickers or references like W3Schools.
