colorizr 2.0.0-1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +311 -101
  2. package/esm/brightness-difference.js +8 -7
  3. package/esm/brightness-difference.js.map +1 -1
  4. package/esm/chroma.d.ts +4 -0
  5. package/esm/chroma.js +14 -0
  6. package/esm/chroma.js.map +1 -0
  7. package/esm/color-difference.js +6 -5
  8. package/esm/color-difference.js.map +1 -1
  9. package/esm/{wcag.d.ts → compare.d.ts} +1 -1
  10. package/esm/compare.js +36 -0
  11. package/esm/compare.js.map +1 -0
  12. package/esm/contrast.js +9 -13
  13. package/esm/contrast.js.map +1 -1
  14. package/esm/darken.d.ts +4 -0
  15. package/esm/darken.js +8 -0
  16. package/esm/darken.js.map +1 -0
  17. package/esm/desaturate.d.ts +4 -0
  18. package/esm/desaturate.js +8 -0
  19. package/esm/desaturate.js.map +1 -0
  20. package/esm/fade.d.ts +5 -0
  21. package/esm/fade.js +23 -0
  22. package/esm/fade.js.map +1 -0
  23. package/esm/format-css.js +10 -11
  24. package/esm/format-css.js.map +1 -1
  25. package/esm/format-hex.js +7 -7
  26. package/esm/format-hex.js.map +1 -1
  27. package/esm/hex2hsl.js +2 -2
  28. package/esm/hex2hsl.js.map +1 -1
  29. package/esm/hex2rgb.js +3 -3
  30. package/esm/hex2rgb.js.map +1 -1
  31. package/esm/hsl2hex.js +2 -5
  32. package/esm/hsl2hex.js.map +1 -1
  33. package/esm/hsl2rgb.d.ts +1 -1
  34. package/esm/hsl2rgb.js +13 -13
  35. package/esm/hsl2rgb.js.map +1 -1
  36. package/esm/index.d.ts +35 -39
  37. package/esm/index.js +138 -190
  38. package/esm/index.js.map +1 -1
  39. package/esm/is-valid-color.d.ts +1 -0
  40. package/esm/is-valid-color.js +11 -0
  41. package/esm/is-valid-color.js.map +1 -0
  42. package/esm/is-valid-hex.js +2 -2
  43. package/esm/is-valid-hex.js.map +1 -1
  44. package/esm/lighten.d.ts +4 -0
  45. package/esm/lighten.js +8 -0
  46. package/esm/lighten.js.map +1 -0
  47. package/esm/luminance.js +9 -8
  48. package/esm/luminance.js.map +1 -1
  49. package/esm/modules/css-colors.d.ts +152 -0
  50. package/esm/modules/css-colors.js +153 -0
  51. package/esm/modules/css-colors.js.map +1 -0
  52. package/esm/{hue2rgb.d.ts → modules/hue2rgb.d.ts} +0 -0
  53. package/esm/{hue2rgb.js → modules/hue2rgb.js} +2 -2
  54. package/esm/modules/hue2rgb.js.map +1 -0
  55. package/esm/{parse-color.d.ts → modules/parse-color.d.ts} +1 -1
  56. package/esm/{parse-color.js → modules/parse-color.js} +14 -14
  57. package/esm/modules/parse-color.js.map +1 -0
  58. package/esm/modules/updater.d.ts +4 -0
  59. package/esm/modules/updater.js +19 -0
  60. package/esm/modules/updater.js.map +1 -0
  61. package/esm/{utils.d.ts → modules/utils.d.ts} +14 -5
  62. package/esm/{utils.js → modules/utils.js} +61 -61
  63. package/esm/modules/utils.js.map +1 -0
  64. package/esm/name.d.ts +1 -0
  65. package/esm/name.js +10 -0
  66. package/esm/name.js.map +1 -0
  67. package/esm/palette.js +16 -25
  68. package/esm/palette.js.map +1 -1
  69. package/esm/parse-css.d.ts +3 -3
  70. package/esm/parse-css.js +60 -43
  71. package/esm/parse-css.js.map +1 -1
  72. package/esm/random.js +1 -1
  73. package/esm/random.js.map +1 -1
  74. package/esm/rgb2hex.d.ts +1 -1
  75. package/esm/rgb2hex.js +11 -12
  76. package/esm/rgb2hex.js.map +1 -1
  77. package/esm/rgb2hsl.d.ts +1 -1
  78. package/esm/rgb2hsl.js +14 -14
  79. package/esm/rgb2hsl.js.map +1 -1
  80. package/esm/rotate.d.ts +3 -0
  81. package/esm/rotate.js +13 -8
  82. package/esm/rotate.js.map +1 -1
  83. package/esm/saturate.d.ts +4 -0
  84. package/esm/saturate.js +8 -0
  85. package/esm/saturate.js.map +1 -0
  86. package/esm/scheme.d.ts +5 -0
  87. package/esm/scheme.js +44 -0
  88. package/esm/scheme.js.map +1 -0
  89. package/esm/shift.d.ts +4 -1
  90. package/esm/shift.js +9 -18
  91. package/esm/shift.js.map +1 -1
  92. package/esm/text-color.js +6 -5
  93. package/esm/text-color.js.map +1 -1
  94. package/esm/types/index.d.ts +4 -1
  95. package/lib/brightness-difference.js +10 -9
  96. package/lib/brightness-difference.js.map +1 -1
  97. package/lib/chroma.d.ts +4 -0
  98. package/lib/chroma.js +17 -0
  99. package/lib/chroma.js.map +1 -0
  100. package/lib/color-difference.js +7 -6
  101. package/lib/color-difference.js.map +1 -1
  102. package/lib/{wcag.d.ts → compare.d.ts} +1 -1
  103. package/lib/compare.js +39 -0
  104. package/lib/compare.js.map +1 -0
  105. package/lib/contrast.js +10 -14
  106. package/lib/contrast.js.map +1 -1
  107. package/lib/darken.d.ts +4 -0
  108. package/lib/darken.js +11 -0
  109. package/lib/darken.js.map +1 -0
  110. package/lib/desaturate.d.ts +4 -0
  111. package/lib/desaturate.js +11 -0
  112. package/lib/desaturate.js.map +1 -0
  113. package/lib/fade.d.ts +5 -0
  114. package/lib/fade.js +26 -0
  115. package/lib/fade.js.map +1 -0
  116. package/lib/format-css.js +16 -17
  117. package/lib/format-css.js.map +1 -1
  118. package/lib/format-hex.js +8 -8
  119. package/lib/format-hex.js.map +1 -1
  120. package/lib/hex2hsl.js +5 -5
  121. package/lib/hex2hsl.js.map +1 -1
  122. package/lib/hex2rgb.js +4 -4
  123. package/lib/hex2rgb.js.map +1 -1
  124. package/lib/hsl2hex.js +5 -8
  125. package/lib/hsl2hex.js.map +1 -1
  126. package/lib/hsl2rgb.d.ts +1 -1
  127. package/lib/hsl2rgb.js +16 -16
  128. package/lib/hsl2rgb.js.map +1 -1
  129. package/lib/index.d.ts +35 -39
  130. package/lib/index.js +162 -203
  131. package/lib/index.js.map +1 -1
  132. package/lib/is-valid-color.d.ts +1 -0
  133. package/lib/is-valid-color.js +14 -0
  134. package/lib/is-valid-color.js.map +1 -0
  135. package/lib/is-valid-hex.js +3 -3
  136. package/lib/is-valid-hex.js.map +1 -1
  137. package/lib/lighten.d.ts +4 -0
  138. package/lib/lighten.js +11 -0
  139. package/lib/lighten.js.map +1 -0
  140. package/lib/luminance.js +11 -10
  141. package/lib/luminance.js.map +1 -1
  142. package/lib/modules/css-colors.d.ts +152 -0
  143. package/lib/modules/css-colors.js +156 -0
  144. package/lib/modules/css-colors.js.map +1 -0
  145. package/lib/{hue2rgb.d.ts → modules/hue2rgb.d.ts} +0 -0
  146. package/lib/modules/hue2rgb.js +28 -0
  147. package/lib/modules/hue2rgb.js.map +1 -0
  148. package/lib/{parse-color.d.ts → modules/parse-color.d.ts} +1 -1
  149. package/lib/modules/parse-color.js +59 -0
  150. package/lib/modules/parse-color.js.map +1 -0
  151. package/lib/modules/updater.d.ts +4 -0
  152. package/lib/modules/updater.js +22 -0
  153. package/lib/modules/updater.js.map +1 -0
  154. package/lib/{utils.d.ts → modules/utils.d.ts} +14 -5
  155. package/lib/{utils.js → modules/utils.js} +60 -60
  156. package/lib/modules/utils.js.map +1 -0
  157. package/lib/name.d.ts +1 -0
  158. package/lib/name.js +13 -0
  159. package/lib/name.js.map +1 -0
  160. package/lib/palette.js +19 -28
  161. package/lib/palette.js.map +1 -1
  162. package/lib/parse-css.d.ts +3 -3
  163. package/lib/parse-css.js +66 -49
  164. package/lib/parse-css.js.map +1 -1
  165. package/lib/random.js +3 -3
  166. package/lib/random.js.map +1 -1
  167. package/lib/rgb2hex.d.ts +1 -1
  168. package/lib/rgb2hex.js +12 -13
  169. package/lib/rgb2hex.js.map +1 -1
  170. package/lib/rgb2hsl.d.ts +1 -1
  171. package/lib/rgb2hsl.js +14 -14
  172. package/lib/rgb2hsl.js.map +1 -1
  173. package/lib/rotate.d.ts +3 -0
  174. package/lib/rotate.js +14 -9
  175. package/lib/rotate.js.map +1 -1
  176. package/lib/saturate.d.ts +4 -0
  177. package/lib/saturate.js +11 -0
  178. package/lib/saturate.js.map +1 -0
  179. package/lib/scheme.d.ts +5 -0
  180. package/lib/scheme.js +47 -0
  181. package/lib/scheme.js.map +1 -0
  182. package/lib/shift.d.ts +4 -1
  183. package/lib/shift.js +12 -20
  184. package/lib/shift.js.map +1 -1
  185. package/lib/text-color.js +7 -6
  186. package/lib/text-color.js.map +1 -1
  187. package/lib/types/index.d.ts +4 -1
  188. package/package.json +35 -44
  189. package/src/brightness-difference.ts +7 -5
  190. package/src/chroma.ts +17 -0
  191. package/src/color-difference.ts +6 -5
  192. package/src/{wcag.ts → compare.ts} +4 -5
  193. package/src/contrast.ts +11 -14
  194. package/src/darken.ts +8 -0
  195. package/src/desaturate.ts +8 -0
  196. package/src/fade.ts +30 -0
  197. package/src/format-css.ts +3 -3
  198. package/src/format-hex.ts +4 -4
  199. package/src/hex2hsl.ts +2 -3
  200. package/src/hex2rgb.ts +2 -3
  201. package/src/hsl2hex.ts +2 -7
  202. package/src/hsl2rgb.ts +5 -6
  203. package/src/index.ts +58 -73
  204. package/src/is-valid-color.ts +11 -0
  205. package/src/is-valid-hex.ts +2 -2
  206. package/src/lighten.ts +8 -0
  207. package/src/luminance.ts +8 -7
  208. package/src/modules/css-colors.ts +152 -0
  209. package/src/{hue2rgb.ts → modules/hue2rgb.ts} +1 -4
  210. package/src/{parse-color.ts → modules/parse-color.ts} +14 -14
  211. package/src/modules/updater.ts +22 -0
  212. package/src/{utils.ts → modules/utils.ts} +50 -46
  213. package/src/name.ts +13 -0
  214. package/src/palette.ts +13 -10
  215. package/src/parse-css.ts +70 -49
  216. package/src/rgb2hex.ts +6 -9
  217. package/src/rgb2hsl.ts +4 -5
  218. package/src/rotate.ts +12 -6
  219. package/src/saturate.ts +8 -0
  220. package/src/scheme.ts +50 -0
  221. package/src/shift.ts +9 -9
  222. package/src/text-color.ts +5 -4
  223. package/src/types/index.ts +15 -10
  224. package/esm/harmony.d.ts +0 -5
  225. package/esm/harmony.js +0 -54
  226. package/esm/harmony.js.map +0 -1
  227. package/esm/hue2rgb.js.map +0 -1
  228. package/esm/parse-color.js.map +0 -1
  229. package/esm/utils.js.map +0 -1
  230. package/esm/wcag.js +0 -36
  231. package/esm/wcag.js.map +0 -1
  232. package/lib/harmony.d.ts +0 -5
  233. package/lib/harmony.js +0 -57
  234. package/lib/harmony.js.map +0 -1
  235. package/lib/hue2rgb.js +0 -28
  236. package/lib/hue2rgb.js.map +0 -1
  237. package/lib/parse-color.js +0 -59
  238. package/lib/parse-color.js.map +0 -1
  239. package/lib/utils.js.map +0 -1
  240. package/lib/wcag.js +0 -39
  241. package/lib/wcag.js.map +0 -1
  242. package/src/harmony.ts +0 -58
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Colorizr
2
2
 
3
- [![NPM version](https://badge.fury.io/js/colorizr.svg)](https://www.npmjs.com/package/colorizr) [![build status](https://travis-ci.org/gilbarbara/colorizr.svg)](https://travis-ci.org/gilbarbara/colorizr) [![Maintainability](https://api.codeclimate.com/v1/badges/6d686ce2a9f2a1a47d98/maintainability)](https://codeclimate.com/github/gilbarbara/colorizr/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6d686ce2a9f2a1a47d98/test_coverage)](https://codeclimate.com/github/gilbarbara/colorizr/test_coverage)
3
+ [![NPM version](https://badge.fury.io/js/colorizr.svg)](https://www.npmjs.com/package/colorizr) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/colorizr)](https://bundlephobia.com/result?p=colorizr) [![CI](https://github.com/gilbarbara/colorizr/actions/workflows/main.yml/badge.svg)](https://github.com/gilbarbara/colorizr/actions/workflows/main.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/6d686ce2a9f2a1a47d98/maintainability)](https://codeclimate.com/github/gilbarbara/colorizr/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6d686ce2a9f2a1a47d98/test_coverage)](https://codeclimate.com/github/gilbarbara/colorizr/test_coverage)
4
4
 
5
- Color conversion, manipulation and comparison.
5
+ Color conversion, manipulation, comparison, and analysis.
6
6
 
7
7
  ## Highlights
8
8
 
9
9
  - 🏖 **Easy to use**: Works with HSL and RGB, including CSS strings
10
- - ♿️ **Acessibility:** WCAG analysis and comparison.
11
- - 🛠 **Small:** Less than 4k (gzipped) and zero dependencies.
10
+ - ♿️ **Accessibility:** WCAG analysis and comparison.
11
+ - 🛠 **Small:** Less than 6k (gzipped) and zero dependencies.
12
12
  - 🟦 **Modern:** Written in Typescript.
13
13
 
14
14
  ## Setup
@@ -19,173 +19,383 @@ Color conversion, manipulation and comparison.
19
19
  npm install --save colorizr
20
20
  ```
21
21
 
22
- And import it:
22
+ ## Usage
23
23
 
24
- ```javascript
25
- import Colorizr from 'Colorizr';
24
+ ```typescript
25
+ import { luminance } from 'colorizr';
26
+
27
+ const lux = luminance('#ff0044'); // 0.2168
26
28
  ```
27
29
 
28
- ## Usage
30
+ Or you can create an instance to access all methods:
29
31
 
30
- ```javascript
31
- const colorizr = new Colorizr('#ff0044');
32
+ ```typescript
33
+ import Colorizr from 'Colorizr';
32
34
 
33
- colorizr.hex // #ff0044
34
- colorizr.hsl // { h: 344, s: 100, l: 50 };
35
- colorizr.rgb // { r: 255, g: 0, b: 68 };
35
+ const colorizr = new Colorizr('#ff0044');
36
36
  ```
37
37
 
38
- ## API
38
+ ## Methods
39
39
 
40
- ### Getters
40
+ > String inputs accept css values: hex, rgb(a), hsl(a) and named colors.
41
41
 
42
- **colorizr.hex**
43
- *returns the hex*
42
+ **brightnessDifference(left: string, right: string): number**
43
+ _get the brightness difference between 2 colors_
44
44
 
45
- **colorizr.hsl**
46
- *returns the hsl object*
45
+ ```typescript
46
+ import { brightnessDifference } from 'colorizr';
47
47
 
48
- **colorizr.rgb**
49
- *returns the rgb object*
48
+ brightnessDifference('#fff', 'rgb(255, 0, 68)'); // 171.003
49
+ ```
50
50
 
51
- **colorizr.hue**
52
- *returns the color hue, between 0 and 360*
51
+ **chroma(input: string): number**
52
+ _get the chroma of a color_
53
53
 
54
- **colorizr.saturation**
55
- *returns the color saturation, between 0 and 100*
54
+ ```typescript
55
+ import { chroma } from 'colorizr';
56
56
 
57
- **colorizr.lightness**
58
- *returns the color lightness, between 0 and 100*
57
+ chroma('#ff0044'); // 1
58
+ chroma('#ffc0cb'); // 0.2471
59
+ ```
59
60
 
60
- **colorizr.red**
61
- *returns the color red level, between 0 and 255*
61
+ **colorDifference(left: string, right: string): number**
62
+ _get the color difference between 2 colors_
62
63
 
63
- **colorizr.green**
64
- *returns the color green level, between 0 and 255*
64
+ ```typescript
65
+ import { colorDifference } from 'colorizr';
65
66
 
66
- **colorizr.blue**
67
- *returns the color blue level, between 0 and 255*
67
+ colorDifference('hsl(0, 0%, 100%)', '#f04'); // 442
68
+ ```
68
69
 
69
- **colorizr.luminance**
70
- *returns the color luminance, between 0 and 1*
70
+ **compare(left: string, right: string): Analysis**
71
+ _get the WCAG analysis for two colors_
71
72
 
72
- **colorizr.chroma**
73
- *returns the color chroma, between 0 and 1*
73
+ ```typescript
74
+ import { compare } from 'colorizr';
74
75
 
75
- **colorizr.textColor**
76
- *returns a hex value with the contrasted color*
76
+ compare('#ff0044', '#fff');
77
77
 
78
- ### Manipulation
78
+ {
79
+ "brightnessDifference": 171.003,
80
+ "colorDifference": 442,
81
+ "compliant": 1,
82
+ "contrast": 3.94,
83
+ "largeAA": true,
84
+ "largeAAA": false,
85
+ "normalAA": false,
86
+ "normalAAA": false,
87
+ }
88
+ ```
79
89
 
80
- **colorizr.lighten(percentage: number = 10)**
81
- *returns a hex value with the increased lightness*
90
+ **contrast(left: string, right: string): number**
91
+ _get the WCAG contrast ratio between 2 colors_
82
92
 
83
- **colorizr.darken(percentage: number = 10)**
84
- *returns a hex value with the decreased lightness*
93
+ ```typescript
94
+ import { contrast } from 'colorizr';
85
95
 
86
- **colorizr.saturate(percentage: number = 10)**
87
- *returns a hex value with the increased saturation*
96
+ contrast('hsl(0, 0%, 100%)', 'rgb(255, 0, 68)'); // 3.94
97
+ ```
88
98
 
89
- **colorizr.saturate(percentage: number = 10)**
90
- *returns a hex value with the decreased lightness*
99
+ **darken(input: string, amount = 10): string**
100
+ _get a color with decreased lightness_
91
101
 
92
- **colorizr.invert()**
93
- *returns a hex value with the inverted color*
102
+ ```typescript
103
+ import { darken } from 'colorizr';
94
104
 
95
- **colorizr.fade(percentage: number = 10)**
96
- *returns a css value with alpha*
105
+ darken('#ff0044', 10); // #cc0036
106
+ ```
97
107
 
98
- ### Comparison
108
+ **desaturate(input: string, amount: number): string**
109
+ _get a color with decreased saturation_
99
110
 
100
- **colorizr.compareTo(color: string)**
101
- *returns an object with the analysis (check the wcga result below)*
111
+ ```typescript
112
+ import { desaturate } from 'colorizr';
102
113
 
103
- ## Helpers
114
+ desaturate('#ff0044', 10); // #f20d4a
115
+ ```
104
116
 
105
- These are named exports in case you don't need the whole instance.
117
+ **fade(input: string, amount: number = 10, output?: ColorTypes = 'rgb'): string**
118
+ _get a transparent color_
106
119
 
107
120
  ```typescript
108
- import { hex2hsl } from 'colorizr';
121
+ import { fade } from 'colorizr';
122
+
123
+ fade('hsl(344, 100, 50)', 10); // rgba(255, 0, 68, 0.9)
124
+ fade('#ff0044', 50, 'hsl'); // hsla(344, 100%, 50%, 0.5)
109
125
  ```
110
126
 
111
- **brightnessDifference(left: string, right: string): number**
112
- *get the brightness difference between 2 colors*
127
+ **formatCSS(input: HSL | RGB, options?: FormatOptions): string**
128
+ _get the css string for a color model object_
113
129
 
114
- **colorDifference(left: string, right: string): number**
115
- *get the color difference between 2 colors*
130
+ ```typescript
131
+ import { formatCSS } from 'colorizr';
116
132
 
117
- **contrast(left: string, right: string): number**
118
- *get the color contrast between 2 colors*
133
+ formatCSS({ h: 344, s: 100, l: 50 }, { model: 'rgb' }); // 'rgb(255, 0, 68)'
134
+ formatCSS({ r: 255, g: 0, b: 68 }, { alpha: 0.5, model: 'hsl' }); // 'hsla(344, 100%, 50%, 0.5)'
135
+ ```
119
136
 
120
- **formatCSS(input: HSL | RGB, options?: FormatOptions): string**
121
- *get the css string for a color model*
137
+ **formatHex(input: string): string**
138
+ _format a short hex string of 3 (or 4) digits into 6 (or 8) digits._
122
139
 
123
- **formatHex(input: string): string**
124
- *format a short hex string 3 (or 4) digits into a 6 (or 8) digits.*
140
+ ```typescript
141
+ import { formatHex } from 'colorizr';
125
142
 
126
- **harmony(input: string, type: Harmony): string[]**
127
- *get the harmony scheme for a color*
143
+ formatHex('#07e'); // '#0077ee'
144
+ formatHex('#f058'); // '#ff005588'
145
+ ```
128
146
 
129
147
  **hex2hsl(input: string): HSL**
130
- *convert a hex string into a HSL object*
148
+ _convert a hex string into an HSL object_
149
+
150
+ ```typescript
151
+ import { hex2hsl } from 'colorizr';
152
+
153
+ hex2hsl('#ff0044'); // { h: 344, s: 100, l: 50 }
154
+ ```
131
155
 
132
156
  **hex2rgb(input: string): RGB**
133
- *convert a hex string into a RGB object*
157
+ _convert a hex string into an RGB object_
158
+
159
+ ```typescript
160
+ import { hex2rgb } from 'colorizr';
161
+
162
+ hex2rgb('#ff0044'); // { r: 255, g: 0, b: 68 }
163
+ ```
134
164
 
135
165
  **hsl2hex(input: HSL): string**
136
- *convert a HSL object into a hex string*
166
+ _convert an HSL object into a hex string_
167
+
168
+ ```typescript
169
+ import { hsl2hex } from 'colorizr';
170
+
171
+ hsl2hex({ h: 344, s: 100, l: 50 }); // '#ff0044'
172
+ ```
137
173
 
138
174
  **hsl2rgb(input: HSL): RGB**
139
- *convert a HSL object into a RGB object*
175
+ _convert an HSL object into an RGB object_
140
176
 
141
- **hue2rgb**
177
+ ```typescript
178
+ import { hsl2rgb } from 'colorizr';
179
+
180
+ hsl2rgb({ h: 344, s: 100, l: 50 }); // { r: 255, g: 0, b: 68 }
181
+ ```
182
+
183
+ **isValidColor(input: any): boolean**
184
+ _check if the input can be parsed correctly_
185
+
186
+ ```typescript
187
+ import { isValidColor } from 'colorizr';
188
+
189
+ isValidColor('#f04'); // true
190
+ isValidColor('#ff0044'); // true
191
+ isValidColor('#ff004400'); // true
192
+ isValidColor('rgb(100, 255, 0)'); // true
193
+ isValidColor('hsla(344, 100%, 50%)'); // true
194
+ isValidColor('blue'); // true
195
+ isValidColor('aliceblue'); // true
196
+ isValidColor('#mmff00'); // false
197
+ isValidColor('blue-ish'); // false
198
+ ```
142
199
 
143
200
  **isValidHex(input: any): boolean**
144
- *check if the input is a validHex*
201
+ _check if the input is a valid hex_
202
+
203
+ ```typescript
204
+ import { isValidHex } from 'colorizr';
205
+
206
+ isValidHex('#f04'); // true
207
+ ```
208
+
209
+ **lighten(input: string, amount: number): string**
210
+ _get a color with increased lightness_
211
+
212
+ ```typescript
213
+ import { lighten } from 'colorizr';
214
+
215
+ lighten('#ff0044', 10); // #ff3369
216
+ ```
145
217
 
146
218
  **luminance(input: string): number**
147
- *get the color luminance*
219
+ _get the relative brightness according to the [WCAG definition](https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef). Normalized to `0` for black and `1` for white._
220
+
221
+ ```typescript
222
+ import { luminance } from 'colorizr';
223
+
224
+ luminance('#ff0044'); // 0.2168
225
+ ```
226
+
227
+ **name(input: string): string**
228
+ _get the named color. return the hex code if it can't be named_
229
+
230
+ ```typescript
231
+ import { name } from 'colorizr';
232
+
233
+ name('#ffc0cb', 10); // pink
234
+ name('rgb(176, 224, 230)'); // 'powderblue'
235
+ name('hsl(344, 100, 50)'); // #ff0044
236
+ ```
148
237
 
149
238
  **palette(input: string, options?: PaletteOptions): string[]**
150
- *get a palette for a color*
239
+ _get a palette for a color_
240
+
241
+ ```typescript
242
+ import { palette } from 'colorizr';
151
243
 
152
- **parseCSS(input: string, output: ColorTypes = 'hex')**
153
- *parse a css string to hex, hsl or rgb*
244
+ palette('#ff0044');
245
+ // ['#ff0044', '#ff7700', '#88ff00', '#00ff77', '#0088ff', '#7700ff'];
246
+
247
+ palette('#ff0044', { type: 'monochromatic' });
248
+ // ['#ff99b4', '#ff5582', '#ff1150', '#cc0036', '#880024', '#440012']
249
+ ```
250
+
251
+ **parseCSS(input: string, output: ColorTypes = 'hex'): string | HSL | RGB**
252
+ _parse a css string to hex, hsl, or RGB_
253
+
254
+ ```typescript
255
+ import { parseCSS } from 'colorizr';
256
+
257
+ parseCSS('hsl(270 60% 70%)'); // '#b385e0'
258
+ parseCSS('#ff0044', 'hsl'); // { h: 344, l: 50, s: 100 }
259
+ ```
154
260
 
155
261
  **random(): string**
156
- *get a random color*
262
+ _get a random color_
263
+
264
+ ```typescript
265
+ import { random } from 'colorizr';
266
+
267
+ random(); // '#b385e0'
268
+ ```
157
269
 
158
270
  **rgb2hex(input: RGB | RGBArray): string**
159
- *convert a RGB object into a hex string*
271
+ _convert an RGB object into a hex string_
272
+
273
+ ```typescript
274
+ import { rgb2hex } from 'colorizr';
275
+
276
+ rgb2hex({ r: 255, g: 55, b: 75 }); // '#ff374b'
277
+ rgb2hex([255, 0, 68]); // '#ff0044'
278
+ ```
160
279
 
161
280
  **rgb2hsl(input: RGB | RGBArray): HSL**
162
- *convert a RGB object into a HSL object*
281
+ _convert an RGB object into an HSL object_
163
282
 
164
- **rotate(input: string, degrees = 15): string**
283
+ ```typescript
284
+ import { rgb2hsl } from 'colorizr';
285
+
286
+ rgb2hsl({ r: 255, g: 55, b: 75 }); // { h: 354, s: 100, l: 60.78 }
287
+ rgb2hsl([255, 0, 68]); // { h: 344, s: 100, l: 50 }
288
+ ```
165
289
 
166
- **shift(input: string, options: Partial<HSL | RGB>): string**
290
+ **rotate(input: string, degrees = 15): string** _get a color with changed hue_
167
291
 
168
- **text-color(input: string): string**
169
- *get the constrasting color for the input*
292
+ ```typescript
293
+ import { rotate } from 'colorizr';
294
+
295
+ rotate('#ff0044', 30); // #ff3b00
296
+ ```
170
297
 
171
- **wcag(left: string, right: string): Analysis**
172
- *get the WCAG analysis for two colors*
298
+ **saturate(input: string, amount: number): string**
299
+ _get a color with increased saturation_
173
300
 
174
301
  ```typescript
175
- {
176
- brightnessDifference: 189.041,
177
- colorDifference: 595,
178
- compliant: 2,
179
- contrast: 10.67,
180
- largeAA: true,
181
- largeAAA: true,
182
- normalAA: true,
183
- normalAAA: true,
184
- }
302
+ import { saturate } from 'colorizr';
303
+
304
+ saturate('#ff0044', 10); // #ff0044 (already at the maximum)
305
+ saturate('pink', 10); // #ffc0cb
185
306
  ```
186
307
 
308
+ **scheme(input: string, type: Scheme): string[]**
309
+ _get the scheme for a color_
310
+
311
+ ```typescript
312
+ import { scheme } from 'colorizr';
313
+
314
+ const complementary = scheme('rgb(255, 0, 68)'); // ['#ff0044', '#00ffbb']
315
+ const triadic = scheme('#ff0044', 'triadic'); // ['#ff0044', '#44ff00', '#0044ff']
316
+ ```
317
+
318
+ **textColor(input: string): string**
319
+ _get a contrasting color to use with the text_
320
+
321
+ ```typescript
322
+ import { textColor } from 'colorizr';
323
+
324
+ textColor('#ff0044'); // #ffffff
325
+ textColor('#fff800'); // #000000
326
+ ```
327
+
328
+ ## Instance API
329
+
330
+ ```typescript
331
+ import Colorizr from 'Colorizr';
332
+
333
+ const colorizr = new Colorizr('#ff0044');
334
+
335
+ colorizr.hex; // #ff0044
336
+ colorizr.hsl; // { h: 344, s: 100, l: 50 };
337
+ colorizr.rgb; // { r: 255, g: 0, b: 68 };
338
+ ```
339
+
340
+ ### Getters
341
+
342
+ **colorizr.hex**
343
+ _returns the hex_
344
+
345
+ **colorizr.hsl**
346
+ _returns the HSL object_
347
+
348
+ **colorizr.rgb**
349
+ _returns the RGB object_
350
+
351
+ **colorizr.hue**
352
+ _returns the color hue, between 0 and 360_
353
+
354
+ **colorizr.saturation**
355
+ _returns the color saturation, between 0 and 100_
356
+
357
+ **colorizr.lightness**
358
+ _returns the color lightness, between 0 and 100_
359
+
360
+ **colorizr.red**
361
+ _returns the color red level, between 0 and 255_
362
+
363
+ **colorizr.green**
364
+ _returns the color green level, between 0 and 255_
365
+
366
+ **colorizr.blue**
367
+ _returns the color blue level, between 0 and 255_
368
+
369
+ **colorizr.luminance**
370
+
371
+ **colorizr.chroma**
372
+
373
+ **colorizr.textColor**
374
+
375
+ ### Manipulation
376
+
377
+ **colorizr.lighten(percentage = 10)**
378
+
379
+ **colorizr.darken(percentage = 10)**
380
+
381
+ **colorizr.saturate(percentage = 10)**
382
+
383
+ **colorizr.saturate(percentage = 10)**
384
+
385
+ **colorizr.rotate(degrees = 15)**
386
+
387
+ **colorizr.invert()**
388
+
389
+ **colorizr.fade(percentage = 10)**
390
+
391
+ ### Comparison
392
+
393
+ **colorizr.compare(color: string)**
394
+ _returns an object with the analysis (check the compare output above)_
187
395
 
188
396
  ## References
397
+
189
398
  [calculating-color-contrast](https://24ways.org/2010/calculating-color-contrast/)
190
- [Colour Contrast Check](https://snook.ca/technical/colour_contrast/colour.html)
191
- [Contrast Checker](https://webaim.org/resources/contrastchecker/)
399
+ [Colour Contrast Check](https://snook.ca/technical/colour_contrast/colour.html)
400
+ [Contrast Checker](https://webaim.org/resources/contrastchecker/)
401
+ [Converting Color Spaces in typescript](https://css-tricks.com/converting-color-spaces-in-typescript/)
@@ -1,15 +1,16 @@
1
1
  import hex2rgb from './hex2rgb';
2
- import { invariant, round, isString } from './utils';
2
+ import { invariant, isString, messages, round } from './modules/utils';
3
+ import parseCSS from './parse-css';
3
4
  /**
4
5
  * Get the brightness difference between 2 colors.
5
6
  */
6
7
  export default function brightnessDifference(left, right) {
7
- invariant(!isString(left), 'left is required');
8
- invariant(!isString(right), 'right is required');
9
- var RGBLeft = hex2rgb(left);
10
- var RGBRight = hex2rgb(right);
11
- var rightY = (RGBRight.r * 299 + RGBRight.g * 587 + RGBRight.b * 114) / 1000;
12
- var leftY = (RGBLeft.r * 299 + RGBLeft.g * 587 + RGBLeft.b * 114) / 1000;
8
+ invariant(isString(left), messages.left);
9
+ invariant(isString(right), messages.right);
10
+ const RGBLeft = hex2rgb(parseCSS(left));
11
+ const RGBRight = hex2rgb(parseCSS(right));
12
+ const rightY = (RGBRight.r * 299 + RGBRight.g * 587 + RGBRight.b * 114) / 1000;
13
+ const leftY = (RGBLeft.r * 299 + RGBLeft.g * 587 + RGBLeft.b * 114) / 1000;
13
14
  return round(Math.abs(rightY - leftY), 4);
14
15
  }
15
16
  //# sourceMappingURL=brightness-difference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"brightness-difference.js","sourceRoot":"","sources":["../src/brightness-difference.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAa;IACtE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC/C,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAEjD,IAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IAC/E,IAAM,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3E,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"brightness-difference.js","sourceRoot":"","sources":["../src/brightness-difference.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAa;IACtE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IAC/E,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;IAE3E,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Get the chroma of a color.
3
+ */
4
+ export default function chroma(input: string): number;
package/esm/chroma.js ADDED
@@ -0,0 +1,14 @@
1
+ import hex2rgb from './hex2rgb';
2
+ import { invariant, isString, messages, round } from './modules/utils';
3
+ import parseCSS from './parse-css';
4
+ /**
5
+ * Get the chroma of a color.
6
+ */
7
+ export default function chroma(input) {
8
+ invariant(isString(input), messages.inputString);
9
+ const { r, g, b } = hex2rgb(parseCSS(input));
10
+ const max = Math.max(r, g, b);
11
+ const min = Math.min(r, g, b);
12
+ return round((max - min) / 255, 4);
13
+ }
14
+ //# sourceMappingURL=chroma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chroma.js","sourceRoot":"","sources":["../src/chroma.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAa;IAC1C,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEjD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9B,OAAO,KAAK,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import hex2rgb from './hex2rgb';
2
- import { invariant, isString } from './utils';
2
+ import { invariant, isString, messages } from './modules/utils';
3
+ import parseCSS from './parse-css';
3
4
  /**
4
5
  * Get the difference between 2 colors.
5
6
  */
6
7
  export default function colorDifference(left, right) {
7
- invariant(!isString(left), 'left is required');
8
- invariant(!isString(right), 'right is required');
9
- var RGBLeft = hex2rgb(left);
10
- var RGBRight = hex2rgb(right);
8
+ invariant(isString(left), messages.left);
9
+ invariant(isString(right), messages.right);
10
+ const RGBLeft = hex2rgb(parseCSS(left));
11
+ const RGBRight = hex2rgb(parseCSS(right));
11
12
  return (Math.max(RGBLeft.r, RGBRight.r) -
12
13
  Math.min(RGBLeft.r, RGBRight.r) +
13
14
  (Math.max(RGBLeft.g, RGBRight.g) - Math.min(RGBLeft.g, RGBRight.g)) +
@@ -1 +1 @@
1
- {"version":3,"file":"color-difference.js","sourceRoot":"","sources":["../src/color-difference.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACjE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC/C,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAEjD,IAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAEhC,OAAO,CACL,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/B,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"color-difference.js","sourceRoot":"","sources":["../src/color-difference.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACjE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/B,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC"}
@@ -2,4 +2,4 @@ import { Analysis } from './types';
2
2
  /**
3
3
  * Check 2 colors for WCAG compliance.
4
4
  */
5
- export default function wcag(left: string, right: string): Analysis;
5
+ export default function compare(left: string, right: string): Analysis;
package/esm/compare.js ADDED
@@ -0,0 +1,36 @@
1
+ import getBrightnessDifference from './brightness-difference';
2
+ import getColorDifference from './color-difference';
3
+ import getContrast from './contrast';
4
+ import { invariant, isString, messages } from './modules/utils';
5
+ /**
6
+ * Check 2 colors for WCAG compliance.
7
+ */
8
+ export default function compare(left, right) {
9
+ invariant(isString(left), messages.left);
10
+ invariant(isString(right), messages.right);
11
+ const colorThreshold = 500;
12
+ const brightnessThreshold = 125;
13
+ const colorDifference = getColorDifference(left, right);
14
+ const contrast = getContrast(left, right);
15
+ const brightnessDifference = getBrightnessDifference(left, right);
16
+ const isBright = brightnessDifference >= brightnessThreshold;
17
+ const hasEnoughDifference = colorDifference >= colorThreshold;
18
+ let compliant = 0;
19
+ if (isBright && hasEnoughDifference) {
20
+ compliant = 2;
21
+ }
22
+ else if (isBright || hasEnoughDifference) {
23
+ compliant = 1;
24
+ }
25
+ return {
26
+ brightnessDifference,
27
+ colorDifference,
28
+ compliant,
29
+ contrast,
30
+ largeAA: contrast >= 3,
31
+ largeAAA: contrast >= 4.5,
32
+ normalAA: contrast >= 4.5,
33
+ normalAAA: contrast >= 7,
34
+ };
35
+ }
36
+ //# sourceMappingURL=compare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.js","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,kBAAkB,MAAM,oBAAoB,CAAC;AACpD,OAAO,WAAW,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhE;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,IAAY,EAAE,KAAa;IACzD,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,cAAc,GAAG,GAAG,CAAC;IAC3B,MAAM,mBAAmB,GAAG,GAAG,CAAC;IAEhC,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,oBAAoB,IAAI,mBAAmB,CAAC;IAC7D,MAAM,mBAAmB,GAAG,eAAe,IAAI,cAAc,CAAC;IAE9D,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,IAAI,QAAQ,IAAI,mBAAmB,EAAE;QACnC,SAAS,GAAG,CAAC,CAAC;KACf;SAAM,IAAI,QAAQ,IAAI,mBAAmB,EAAE;QAC1C,SAAS,GAAG,CAAC,CAAC;KACf;IAED,OAAO;QACL,oBAAoB;QACpB,eAAe;QACf,SAAS;QACT,QAAQ;QACR,OAAO,EAAE,QAAQ,IAAI,CAAC;QACtB,QAAQ,EAAE,QAAQ,IAAI,GAAG;QACzB,QAAQ,EAAE,QAAQ,IAAI,GAAG;QACzB,SAAS,EAAE,QAAQ,IAAI,CAAC;KACzB,CAAC;AACJ,CAAC"}