@@ -383,6 +383,157 @@ mod test {
383
383
assert!(aqua().eq(&parse_color(" hsl( 180.0 , 1.0 , . 5 ) ").unwrap()));
384
384
assert!(None == parse_color(" hsl( 1 , 2 , 3 , . 4 ) "));
385
385
}
386
+
387
+ #[test]
388
+ fn text_parsing_rgb_all() {
389
+ assert!(aliceblue().eq(&parse_color(" rgb( 240 , 248 , 255 ) ").unwrap()));
390
+ assert!(antiquewhite().eq(&parse_color(" rgb( 250 , 235 , 215 ) ").unwrap()));
391
+ assert!(aqua().eq(&parse_color(" rgb( 0 , 255 , 255 ) ").unwrap()));
392
+ assert!(aquamarine().eq(&parse_color(" rgb( 127 , 255 , 212 ) ").unwrap()));
393
+ assert!(azure().eq(&parse_color(" rgb( 240 , 255 , 255 ) ").unwrap()));
394
+ assert!(beige().eq(&parse_color(" rgb( 245 , 245 , 220 ) ").unwrap()));
395
+ assert!(bisque().eq(&parse_color(" rgb( 255 , 228 , 196 ) ").unwrap()));
396
+ assert!(black().eq(&parse_color(" rgb( 0 , 0 , 0 ) ").unwrap()));
397
+ assert!(blanchedalmond().eq(&parse_color(" rgb( 255 , 235 , 205 ) ").unwrap()));
398
+ assert!(blue().eq(&parse_color(" rgb( 0 , 0 , 255 ) ").unwrap()));
399
+ assert!(blueviolet().eq(&parse_color(" rgb( 138 , 43 , 226 ) ").unwrap()));
400
+ assert!(brown().eq(&parse_color(" rgb( 165 , 42 , 42 ) ").unwrap()));
401
+ assert!(burlywood().eq(&parse_color(" rgb( 222 , 184 , 135 ) ").unwrap()));
402
+ assert!(cadetblue().eq(&parse_color(" rgb( 95 , 158 , 160 ) ").unwrap()));
403
+ assert!(chartreuse().eq(&parse_color(" rgb( 127 , 255 , 0 ) ").unwrap()));
404
+ assert!(chocolate().eq(&parse_color(" rgb( 210 , 105 , 30 ) ").unwrap()));
405
+ assert!(coral().eq(&parse_color(" rgb( 255 , 127 , 80 ) ").unwrap()));
406
+ assert!(cornflowerblue().eq(&parse_color(" rgb( 100 , 149 , 237 ) ").unwrap()));
407
+ assert!(cornsilk().eq(&parse_color(" rgb( 255 , 248 , 220 ) ").unwrap()));
408
+ assert!(crimson().eq(&parse_color(" rgb( 220 , 20 , 60 ) ").unwrap()));
409
+ assert!(cyan().eq(&parse_color(" rgb( 0 , 255 , 255 ) ").unwrap()));
410
+ assert!(darkblue().eq(&parse_color(" rgb( 0 , 0 , 139 ) ").unwrap()));
411
+ assert!(darkcyan().eq(&parse_color(" rgb( 0 , 139 , 139 ) ").unwrap()));
412
+ assert!(darkgoldenrod().eq(&parse_color(" rgb( 184 , 134 , 11 ) ").unwrap()));
413
+ assert!(darkgray().eq(&parse_color(" rgb( 169 , 169 , 169 ) ").unwrap()));
414
+ assert!(darkgreen().eq(&parse_color(" rgb( 0 , 100 , 0 ) ").unwrap()));
415
+ assert!(darkgrey().eq(&parse_color(" rgb( 169 , 169 , 169 ) ").unwrap()));
416
+ assert!(darkkhaki().eq(&parse_color(" rgb( 189 , 183 , 107 ) ").unwrap()));
417
+ assert!(darkmagenta().eq(&parse_color(" rgb( 139 , 0 , 139 ) ").unwrap()));
418
+ assert!(darkolivegreen().eq(&parse_color(" rgb( 85 , 107 , 47 ) ").unwrap()));
419
+ assert!(darkorange().eq(&parse_color(" rgb( 255 , 140 , 0 ) ").unwrap()));
420
+ assert!(darkorchid().eq(&parse_color(" rgb( 153 , 50 , 204 ) ").unwrap()));
421
+ assert!(darkred().eq(&parse_color(" rgb( 139 , 0 , 0 ) ").unwrap()));
422
+ assert!(darksalmon().eq(&parse_color(" rgb( 233 , 150 , 122 ) ").unwrap()));
423
+ assert!(darkseagreen().eq(&parse_color(" rgb( 143 , 188 , 143 ) ").unwrap()));
424
+ assert!(darkslateblue().eq(&parse_color(" rgb( 72 , 61 , 139 ) ").unwrap()));
425
+ assert!(darkslategray().eq(&parse_color(" rgb( 47 , 79 , 79 ) ").unwrap()));
426
+ assert!(darkslategrey().eq(&parse_color(" rgb( 47 , 79 , 79 ) ").unwrap()));
427
+ assert!(darkturquoise().eq(&parse_color(" rgb( 0 , 206 , 209 ) ").unwrap()));
428
+ assert!(darkviolet().eq(&parse_color(" rgb( 148 , 0 , 211 ) ").unwrap()));
429
+ assert!(deeppink().eq(&parse_color(" rgb( 255 , 20 , 147 ) ").unwrap()));
430
+ assert!(deepskyblue().eq(&parse_color(" rgb( 0 , 191 , 255 ) ").unwrap()));
431
+ assert!(dimgray().eq(&parse_color(" rgb( 105 , 105 , 105 ) ").unwrap()));
432
+ assert!(dimgrey().eq(&parse_color(" rgb( 105 , 105 , 105 ) ").unwrap()));
433
+ assert!(dodgerblue().eq(&parse_color(" rgb( 30 , 144 , 255 ) ").unwrap()));
434
+ assert!(firebrick().eq(&parse_color(" rgb( 178 , 34 , 34 ) ").unwrap()));
435
+ assert!(floralwhite().eq(&parse_color(" rgb( 255 , 250 , 240 ) ").unwrap()));
436
+ assert!(forestgreen().eq(&parse_color(" rgb( 34 , 139 , 34 ) ").unwrap()));
437
+ assert!(fuchsia().eq(&parse_color(" rgb( 255 , 0 , 255 ) ").unwrap()));
438
+ assert!(gainsboro().eq(&parse_color(" rgb( 220 , 220 , 220 ) ").unwrap()));
439
+ assert!(ghostwhite().eq(&parse_color(" rgb( 248 , 248 , 255 ) ").unwrap()));
440
+ assert!(gold().eq(&parse_color(" rgb( 255 , 215 , 0 ) ").unwrap()));
441
+ assert!(goldenrod().eq(&parse_color(" rgb( 218 , 165 , 32 ) ").unwrap()));
442
+ assert!(gray().eq(&parse_color(" rgb( 128 , 128 , 128 ) ").unwrap()));
443
+ assert!(grey().eq(&parse_color(" rgb( 128 , 128 , 128 ) ").unwrap()));
444
+ assert!(green().eq(&parse_color(" rgb( 0 , 128 , 0 ) ").unwrap()));
445
+ assert!(greenyellow().eq(&parse_color(" rgb( 173 , 255 , 47 ) ").unwrap()));
446
+ assert!(honeydew().eq(&parse_color(" rgb( 240 , 255 , 240 ) ").unwrap()));
447
+ assert!(hotpink().eq(&parse_color(" rgb( 255 , 105 , 180 ) ").unwrap()));
448
+ assert!(indianred().eq(&parse_color(" rgb( 205 , 92 , 92 ) ").unwrap()));
449
+ assert!(indigo().eq(&parse_color(" rgb( 75 , 0 , 130 ) ").unwrap()));
450
+ assert!(ivory().eq(&parse_color(" rgb( 255 , 255 , 240 ) ").unwrap()));
451
+ assert!(khaki().eq(&parse_color(" rgb( 240 , 230 , 140 ) ").unwrap()));
452
+ assert!(lavender().eq(&parse_color(" rgb( 230 , 230 , 250 ) ").unwrap()));
453
+ assert!(lavenderblush().eq(&parse_color(" rgb( 255 , 240 , 245 ) ").unwrap()));
454
+ assert!(lawngreen().eq(&parse_color(" rgb( 124 , 252 , 0 ) ").unwrap()));
455
+ assert!(lemonchiffon().eq(&parse_color(" rgb( 255 , 250 , 205 ) ").unwrap()));
456
+ assert!(lightblue().eq(&parse_color(" rgb( 173 , 216 , 230 ) ").unwrap()));
457
+ assert!(lightcoral().eq(&parse_color(" rgb( 240 , 128 , 128 ) ").unwrap()));
458
+ assert!(lightcyan().eq(&parse_color(" rgb( 224 , 255 , 255 ) ").unwrap()));
459
+ assert!(lightgoldenrodyellow().eq(&parse_color(" rgb( 250 , 250 , 210 ) ").unwrap()));
460
+ assert!(lightgray().eq(&parse_color(" rgb( 211 , 211 , 211 ) ").unwrap()));
461
+ assert!(lightgreen().eq(&parse_color(" rgb( 144 , 238 , 144 ) ").unwrap()));
462
+ assert!(lightgrey().eq(&parse_color(" rgb( 211 , 211 , 211 ) ").unwrap()));
463
+ assert!(lightpink().eq(&parse_color(" rgb( 255 , 182 , 193 ) ").unwrap()));
464
+ assert!(lightsalmon().eq(&parse_color(" rgb( 255 , 160 , 122 ) ").unwrap()));
465
+ assert!(lightseagreen().eq(&parse_color(" rgb( 32 , 178 , 170 ) ").unwrap()));
466
+ assert!(lightskyblue().eq(&parse_color(" rgb( 135 , 206 , 250 ) ").unwrap()));
467
+ assert!(lightslategray().eq(&parse_color(" rgb( 119 , 136 , 153 ) ").unwrap()));
468
+ assert!(lightslategrey().eq(&parse_color(" rgb( 119 , 136 , 153 ) ").unwrap()));
469
+ assert!(lightsteelblue().eq(&parse_color(" rgb( 176 , 196 , 222 ) ").unwrap()));
470
+ assert!(lightyellow().eq(&parse_color(" rgb( 255 , 255 , 224 ) ").unwrap()));
471
+ assert!(lime().eq(&parse_color(" rgb( 0 , 255 , 0 ) ").unwrap()));
472
+ assert!(limegreen().eq(&parse_color(" rgb( 50 , 205 , 50 ) ").unwrap()));
473
+ assert!(linen().eq(&parse_color(" rgb( 250 , 240 , 230 ) ").unwrap()));
474
+ assert!(magenta().eq(&parse_color(" rgb( 255 , 0 , 255 ) ").unwrap()));
475
+ assert!(maroon().eq(&parse_color(" rgb( 128 , 0 , 0 ) ").unwrap()));
476
+ assert!(mediumaquamarine().eq(&parse_color(" rgb( 102 , 205 , 170 ) ").unwrap()));
477
+ assert!(mediumblue().eq(&parse_color(" rgb( 0 , 0 , 205 ) ").unwrap()));
478
+ assert!(mediumorchid().eq(&parse_color(" rgb( 186 , 85 , 211 ) ").unwrap()));
479
+ assert!(mediumpurple().eq(&parse_color(" rgb( 147 , 112 , 219 ) ").unwrap()));
480
+ assert!(mediumseagreen().eq(&parse_color(" rgb( 60 , 179 , 113 ) ").unwrap()));
481
+ assert!(mediumslateblue().eq(&parse_color(" rgb( 123 , 104 , 238 ) ").unwrap()));
482
+ assert!(mediumspringgreen().eq(&parse_color(" rgb( 0 , 250 , 154 ) ").unwrap()));
483
+ assert!(mediumturquoise().eq(&parse_color(" rgb( 72 , 209 , 204 ) ").unwrap()));
484
+ assert!(mediumvioletred().eq(&parse_color(" rgb( 199 , 21 , 133 ) ").unwrap()));
485
+ assert!(midnightblue().eq(&parse_color(" rgb( 25 , 25 , 112 ) ").unwrap()));
486
+ assert!(mintcream().eq(&parse_color(" rgb( 245 , 255 , 250 ) ").unwrap()));
487
+ assert!(mistyrose().eq(&parse_color(" rgb( 255 , 228 , 225 ) ").unwrap()));
488
+ assert!(moccasin().eq(&parse_color(" rgb( 255 , 228 , 181 ) ").unwrap()));
489
+ assert!(navajowhite().eq(&parse_color(" rgb( 255 , 222 , 173 ) ").unwrap()));
490
+ assert!(navy().eq(&parse_color(" rgb( 0 , 0 , 128 ) ").unwrap()));
491
+ assert!(oldlace().eq(&parse_color(" rgb( 253 , 245 , 230 ) ").unwrap()));
492
+ assert!(olive().eq(&parse_color(" rgb( 128 , 128 , 0 ) ").unwrap()));
493
+ assert!(olivedrab().eq(&parse_color(" rgb( 107 , 142 , 35 ) ").unwrap()));
494
+ assert!(orange().eq(&parse_color(" rgb( 255 , 165 , 0 ) ").unwrap()));
495
+ assert!(orangered().eq(&parse_color(" rgb( 255 , 69 , 0 ) ").unwrap()));
496
+ assert!(orchid().eq(&parse_color(" rgb( 218 , 112 , 214 ) ").unwrap()));
497
+ assert!(palegoldenrod().eq(&parse_color(" rgb( 238 , 232 , 170 ) ").unwrap()));
498
+ assert!(palegreen().eq(&parse_color(" rgb( 152 , 251 , 152 ) ").unwrap()));
499
+ assert!(paleturquoise().eq(&parse_color(" rgb( 175 , 238 , 238 ) ").unwrap()));
500
+ assert!(palevioletred().eq(&parse_color(" rgb( 219 , 112 , 147 ) ").unwrap()));
501
+ assert!(papayawhip().eq(&parse_color(" rgb( 255 , 239 , 213 ) ").unwrap()));
502
+ assert!(peachpuff().eq(&parse_color(" rgb( 255 , 218 , 185 ) ").unwrap()));
503
+ assert!(peru().eq(&parse_color(" rgb( 205 , 133 , 63 ) ").unwrap()));
504
+ assert!(pink().eq(&parse_color(" rgb( 255 , 192 , 203 ) ").unwrap()));
505
+ assert!(plum().eq(&parse_color(" rgb( 221 , 160 , 221 ) ").unwrap()));
506
+ assert!(powderblue().eq(&parse_color(" rgb( 176 , 224 , 230 ) ").unwrap()));
507
+ assert!(purple().eq(&parse_color(" rgb( 128 , 0 , 128 ) ").unwrap()));
508
+ assert!(red().eq(&parse_color(" rgb( 255 , 0 , 0 ) ").unwrap()));
509
+ assert!(rosybrown().eq(&parse_color(" rgb( 188 , 143 , 143 ) ").unwrap()));
510
+ assert!(royalblue().eq(&parse_color(" rgb( 65 , 105 , 225 ) ").unwrap()));
511
+ assert!(saddlebrown().eq(&parse_color(" rgb( 139 , 69 , 19 ) ").unwrap()));
512
+ assert!(salmon().eq(&parse_color(" rgb( 250 , 128 , 114 ) ").unwrap()));
513
+ assert!(sandybrown().eq(&parse_color(" rgb( 244 , 164 , 96 ) ").unwrap()));
514
+ assert!(seagreen().eq(&parse_color(" rgb( 46 , 139 , 87 ) ").unwrap()));
515
+ assert!(seashell().eq(&parse_color(" rgb( 255 , 245 , 238 ) ").unwrap()));
516
+ assert!(sienna().eq(&parse_color(" rgb( 160 , 82 , 45 ) ").unwrap()));
517
+ assert!(silver().eq(&parse_color(" rgb( 192 , 192 , 192 ) ").unwrap()));
518
+ assert!(skyblue().eq(&parse_color(" rgb( 135 , 206 , 235 ) ").unwrap()));
519
+ assert!(slateblue().eq(&parse_color(" rgb( 106 , 90 , 205 ) ").unwrap()));
520
+ assert!(slategray().eq(&parse_color(" rgb( 112 , 128 , 144 ) ").unwrap()));
521
+ assert!(slategrey().eq(&parse_color(" rgb( 112 , 128 , 144 ) ").unwrap()));
522
+ assert!(snow().eq(&parse_color(" rgb( 255 , 250 , 250 ) ").unwrap()));
523
+ assert!(springgreen().eq(&parse_color(" rgb( 0 , 255 , 127 ) ").unwrap()));
524
+ assert!(steelblue().eq(&parse_color(" rgb( 70 , 130 , 180 ) ").unwrap()));
525
+ assert!(tan().eq(&parse_color(" rgb( 210 , 180 , 140 ) ").unwrap()));
526
+ assert!(teal().eq(&parse_color(" rgb( 0 , 128 , 128 ) ").unwrap()));
527
+ assert!(thistle().eq(&parse_color(" rgb( 216 , 191 , 216 ) ").unwrap()));
528
+ assert!(tomato().eq(&parse_color(" rgb( 255 , 99 , 71 ) ").unwrap()));
529
+ assert!(turquoise().eq(&parse_color(" rgb( 64 , 224 , 208 ) ").unwrap()));
530
+ assert!(violet().eq(&parse_color(" rgb( 238 , 130 , 238 ) ").unwrap()));
531
+ assert!(wheat().eq(&parse_color(" rgb( 245 , 222 , 179 ) ").unwrap()));
532
+ assert!(white().eq(&parse_color(" rgb( 255 , 255 , 255 ) ").unwrap()));
533
+ assert!(whitesmoke().eq(&parse_color(" rgb( 245 , 245 , 245 ) ").unwrap()));
534
+ assert!(yellow().eq(&parse_color(" rgb( 255 , 255 , 0 ) ").unwrap()));
535
+ assert!(yellowgreen().eq(&parse_color(" rgb( 154 , 205 , 50 ) " ) . unwrap( ) ) ) ;
536
+ }
386
537
}
387
538
388
539
0 commit comments