#FF0000 can be shortened to #F00. This shortened form gives one digit for red, one digit for green, and one digit for blue.
This reduces the total number of possible colors to around 4,000. But browsers will interpret #FF0000 and #F00 as exactly the same color.
| Color | Short Hex Code |
|---|---|
| Cyan | #0FF |
| Green | #0F0 |
| Red | #F00 |
| Fuchsia | #F0F |
h1 element with the text I am red! should be given the color red.
testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
- text: The abbreviated hex code for the color red should be used instead of the hex code #FF0000.
testString: assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi));
- text: Your h1 element with the text I am green! should be given the color green.
testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
- text: The abbreviated hex code for the color green should be used instead of the hex code #00FF00.
testString: assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi));
- text: Your h1 element with the text I am cyan! should be given the color cyan.
testString: assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)');
- text: The abbreviated hex code for the color cyan should be used instead of the hex code #00FFFF.
testString: assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi));
- text: Your h1 element with the text I am fuchsia! should be given the color fuchsia.
testString: assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)');
- text: The abbreviated hex code for the color fuchsia should be used instead of the hex code #FF00FF.
testString: assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi));
```