--- id: bad87fee1348bd9aedf08719 title: Use Abbreviated Hex Code challengeType: 0 videoUrl: '' localeTitle: 使用缩写的十六进制代码 --- ## Description
许多人对超过1600万种颜色的可能性感到不知所措。并且很难记住十六进制代码。幸运的是,你可以缩短它。例如,红色的十六进制代码#FF0000可以缩短为#F00 。这个缩短的形式给出一个红色数字,一个数字表示绿色,一个数字表示蓝色。这将可能的颜色总数减少到大约4,000。但浏览器会将#FF0000#F00解释为完全相同的颜色。
## Instructions
继续,尝试使用缩写的十六进制代码为正确的元素着色。
颜色短十六进制代码
青色 #0FF
绿色 #0F0
#F00
紫红色 #F0F
## Tests
```yml tests: - text: 给你的h1元素添加I am red!的文本I am red! color红色。 testString: 'assert($(".red-text").css("color") === "rgb(255, 0, 0)", "Give your h1 element with the text I am red! the color red.");' - text: '使用缩写hex code表示红色而不是十六进制代码#FF0000 。' testString: 'assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), "Use the abbreviate hex code for the color red instead of the hex code #FF0000.");' - text: 给你的h1元素添加I am green!的文本I am green! color绿色。 testString: 'assert($(".green-text").css("color") === "rgb(0, 255, 0)", "Give your h1 element with the text I am green! the color green.");' - text: '使用缩写的hex code表示绿色而不是十六进制代码#00FF00 。' testString: 'assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), "Use the abbreviated hex code for the color green instead of the hex code #00FF00.");' - text: 给你的h1元素添加I am cyan!文字I am cyan!color青色。 testString: 'assert($(".cyan-text").css("color") === "rgb(0, 255, 255)", "Give your h1 element with the text I am cyan! the color cyan.");' - text: '使用缩写的hex code代替十六进制代码#00FFFF 。' testString: 'assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), "Use the abbreviated hex code for the color cyan instead of the hex code #00FFFF.");' - text: 给你的h1元素文字I am fuchsia! color紫红色。 testString: 'assert($(".fuchsia-text").css("color") === "rgb(255, 0, 255)", "Give your h1 element with the text I am fuchsia! the color fuchsia.");' - text: '使用缩写的hex code作为颜色的紫红色而不是十六进制代码#FF00FF 。' testString: 'assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), "Use the abbreviated hex code for the color fuchsia instead of the hex code #FF00FF.");' ```
## Challenge Seed
```html

I am red!

I am fuchsia!

I am cyan!

I am green!

```
## Solution
```js // solution required ```