@@ -126,6 +126,14 @@ public function colorProvider()
126126 0.5 ,
127127 ColorRepresentation::COLOR_RGB ,
128128 ],
129+ 'rgb alpha truncated ' => [
130+ 'rgb(123, 45, 67, .5) ' ,
131+ 123 ,
132+ 45 ,
133+ 67 ,
134+ 0.5 ,
135+ ColorRepresentation::COLOR_RGB ,
136+ ],
129137 'rgb alpha percent ' => [
130138 'rgb(50%, 60%, 70%, 50%) ' ,
131139 128 ,
@@ -135,7 +143,7 @@ public function colorProvider()
135143 ColorRepresentation::COLOR_RGB ,
136144 ],
137145 'rgb alpha whitespace ' => [
138- ' rgb ( 123 45 67 / 0.5 ) ' ,
146+ ' rgb ( 123 , 45 , 67 , 0.5 ) ' ,
139147 123 ,
140148 45 ,
141149 67 ,
@@ -166,6 +174,70 @@ public function colorProvider()
166174 1.0 ,
167175 ColorRepresentation::COLOR_RGBA ,
168176 ],
177+ 'new rbg ' => [
178+ 'rgb(123 45 67) ' ,
179+ 123 ,
180+ 45 ,
181+ 67 ,
182+ 1.0 ,
183+ ColorRepresentation::COLOR_RGB ,
184+ ],
185+ 'new rgb alpha ' => [
186+ 'rgb(123 45 67 / 0.5) ' ,
187+ 123 ,
188+ 45 ,
189+ 67 ,
190+ 0.5 ,
191+ ColorRepresentation::COLOR_RGB ,
192+ ],
193+ 'new rgb alpha truncated ' => [
194+ 'rgb(123 45 67 / .5) ' ,
195+ 123 ,
196+ 45 ,
197+ 67 ,
198+ 0.5 ,
199+ ColorRepresentation::COLOR_RGB ,
200+ ],
201+ 'new rgb alpha percent ' => [
202+ 'rgb(50% 60% 70% / 50%) ' ,
203+ 128 ,
204+ 153 ,
205+ 179 ,
206+ 0.5 ,
207+ ColorRepresentation::COLOR_RGB ,
208+ ],
209+ 'new rgb alpha whitespace ' => [
210+ ' rgb ( 123 45 67 / 0.5 ) ' ,
211+ 123 ,
212+ 45 ,
213+ 67 ,
214+ 0.5 ,
215+ ColorRepresentation::COLOR_RGB ,
216+ ],
217+ 'new rgb uppercase ' => [
218+ 'RGB(1 2 3) ' ,
219+ 1 ,
220+ 2 ,
221+ 3 ,
222+ 1.0 ,
223+ ColorRepresentation::COLOR_RGB ,
224+ ],
225+ 'new rgba ' => [
226+ 'rgba(123 45 67 / 0.5) ' ,
227+ 123 ,
228+ 45 ,
229+ 67 ,
230+ 0.5 ,
231+ ColorRepresentation::COLOR_RGBA ,
232+ ],
233+ 'new rgba without alpha ' => [
234+ 'rgba(123 45 67) ' ,
235+ 123 ,
236+ 45 ,
237+ 67 ,
238+ 1.0 ,
239+ ColorRepresentation::COLOR_RGBA ,
240+ ],
169241 'hsl ' => [
170242 'hsl(120, 100%, 50%) ' ,
171243 0 ,
@@ -270,6 +342,8 @@ public function badColorProvider()
270342 'invalid hsl range ' => ['hsl(0, 120%, 120%) ' ],
271343 'invalid hsl alpha range ' => ['hsl(0, 0%, 0%, 2) ' ],
272344 'invalid name ' => ['thatcolorbehindyoureyelids ' ],
345+ 'invalid new without / ' => ['rgba(1 2 3 4%) ' ],
346+ 'invalid new mix ' => ['rgb(1, 2 3) ' ],
273347 ];
274348 }
275349
0 commit comments