UNPKG

1.1 kBMarkdownView Raw
1# color-hex-length
2
3Specify short or long notation for hex colors.
4
5<!-- prettier-ignore -->
6```css
7a { color: #fff }
8/** ↑
9 * This hex color */
10```
11
12The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
13
14## Options
15
16`string`: `"short"|"long"`
17
18### `"short"`
19
20The following patterns are considered violations:
21
22<!-- prettier-ignore -->
23```css
24a { color: #ffffff; }
25```
26
27<!-- prettier-ignore -->
28```css
29a { color: #ffffffaa; }
30```
31
32The following patterns are _not_ considered violations:
33
34<!-- prettier-ignore -->
35```css
36a { color: #fff; }
37```
38
39<!-- prettier-ignore -->
40```css
41a { color: #fffa; }
42```
43
44<!-- prettier-ignore -->
45```css
46a { color: #a4a4a4; }
47```
48
49### `"long"`
50
51The following patterns are considered violations:
52
53<!-- prettier-ignore -->
54```css
55a { color: #fff; }
56```
57
58<!-- prettier-ignore -->
59```css
60a { color: #fffa; }
61```
62
63The following patterns are _not_ considered violations:
64
65<!-- prettier-ignore -->
66```css
67a { color: #ffffff; }
68```
69
70<!-- prettier-ignore -->
71```css
72a { color: #ffffffaa; }
73```