@@ -319,6 +319,202 @@ void main() {
319
319
});
320
320
});
321
321
322
+ group ('dark' , () {
323
+ test ('base' , () {
324
+ check (StreamColorSwatch .dark (0xffffffff ))
325
+ .base .equals (const Color (0xffffffff ));
326
+ });
327
+
328
+ test ('unreadCountBadgeBackground' , () {
329
+ void runCheck (int base , Color expected) {
330
+ check (StreamColorSwatch .dark (base ))
331
+ .unreadCountBadgeBackground.equals (expected);
332
+ }
333
+
334
+ // Check against everything in ZULIP_ASSIGNMENT_COLORS and EXTREME_COLORS
335
+ // in <https://replit.com/@VladKorobov/zulip-sidebar#script.js>.
336
+ // On how to extract expected results from the replit, see:
337
+ // https://github.com/zulip/zulip-flutter/pull/643#issuecomment-2093940972
338
+
339
+ // TODO Fix bug causing our implementation's results to differ from the
340
+ // replit's. Where they differ, see comment with what the replit gives.
341
+
342
+ // ZULIP_ASSIGNMENT_COLORS
343
+ runCheck (0xff76ce90 , const Color (0x4d65bd80 ));
344
+ runCheck (0xfffae589 , const Color (0x4dbdab53 )); // 0x4dbdaa52
345
+ runCheck (0xffa6c7e5 , const Color (0x4d8eafcc )); // 0x4d8fb0cd
346
+ runCheck (0xffe79ab5 , const Color (0x4de295b0 )); // 0x4de194af
347
+ runCheck (0xffbfd56f , const Color (0x4d9eb551 )); // 0x4d9eb450
348
+ runCheck (0xfff4ae55 , const Color (0x4de19d45 )); // 0x4de09c44
349
+ runCheck (0xffb0a5fd , const Color (0x4daba0f8 )); // 0x4daca2f9
350
+ runCheck (0xffaddfe5 , const Color (0x4d83b4b9 )); // 0x4d83b4ba
351
+ runCheck (0xfff5ce6e , const Color (0x4dcba749 )); // 0x4dcaa648
352
+ runCheck (0xffc2726a , const Color (0x4dc2726a ));
353
+ runCheck (0xff94c849 , const Color (0x4d86ba3c )); // 0x4d86ba3b
354
+ runCheck (0xffbd86e5 , const Color (0x4dbd86e5 ));
355
+ runCheck (0xffee7e4a , const Color (0x4dee7e4a ));
356
+ runCheck (0xffa6dcbf , const Color (0x4d82b69b )); // 0x4d82b79b
357
+ runCheck (0xff95a5fd , const Color (0x4d95a5fd ));
358
+ runCheck (0xff53a063 , const Color (0x4d53a063 ));
359
+ runCheck (0xff9987e1 , const Color (0x4d9987e1 ));
360
+ runCheck (0xffe4523d , const Color (0x4de4523d ));
361
+ runCheck (0xffc2c2c2 , const Color (0x4dababab ));
362
+ runCheck (0xff4f8de4 , const Color (0x4d4f8de4 ));
363
+ runCheck (0xffc6a8ad , const Color (0x4dc2a4a9 )); // 0x4dc1a4a9
364
+ runCheck (0xffe7cc4d , const Color (0x4dc3ab2a )); // 0x4dc2aa28
365
+ runCheck (0xffc8bebf , const Color (0x4db3a9aa ));
366
+ runCheck (0xffa47462 , const Color (0x4da47462 ));
367
+
368
+ // EXTREME_COLORS
369
+ runCheck (0xFFFFFFFF , const Color (0x4dababab ));
370
+ runCheck (0xFF000000 , const Color (0x4d474747 ));
371
+ runCheck (0xFFD3D3D3 , const Color (0x4dababab ));
372
+ runCheck (0xFFA9A9A9 , const Color (0x4da9a9a9 ));
373
+ runCheck (0xFF808080 , const Color (0x4d808080 ));
374
+ runCheck (0xFFFFFF00 , const Color (0x4dacb300 )); // 0x4dacb200
375
+ runCheck (0xFFFF0000 , const Color (0x4dff0000 ));
376
+ runCheck (0xFF008000 , const Color (0x4d008000 ));
377
+ runCheck (0xFF0000FF , const Color (0x4d0000ff )); // 0x4d0902ff
378
+ runCheck (0xFFEE82EE , const Color (0x4dee82ee ));
379
+ runCheck (0xFFFFA500 , const Color (0x4def9800 )); // 0x4ded9600
380
+ runCheck (0xFF800080 , const Color (0x4d810181 )); // 0x4d810281
381
+ runCheck (0xFF00FFFF , const Color (0x4d00c2c3 )); // 0x4d00c3c5
382
+ runCheck (0xFFFF00FF , const Color (0x4dff00ff ));
383
+ runCheck (0xFF00FF00 , const Color (0x4d00cb00 ));
384
+ runCheck (0xFF800000 , const Color (0x4d8d140c )); // 0x4d8b130b
385
+ runCheck (0xFF008080 , const Color (0x4d008080 ));
386
+ runCheck (0xFF000080 , const Color (0x4d492bae )); // 0x4d4b2eb3
387
+ runCheck (0xFFFFFFE0 , const Color (0x4dadad90 )); // 0x4dacad90
388
+ runCheck (0xFFFF69B4 , const Color (0x4dff69b4 ));
389
+ });
390
+
391
+ test ('iconOnPlainBackground' , () {
392
+ void runCheck (int base , Color expected) {
393
+ check (StreamColorSwatch .dark (base ))
394
+ .iconOnPlainBackground.equals (expected);
395
+ }
396
+
397
+ // Check against everything in ZULIP_ASSIGNMENT_COLORS
398
+ // in <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>.
399
+ // (Skipping `streamColors` because there are 100+ of them.)
400
+ // On how to extract expected results from the replit, see:
401
+ // https://github.com/zulip/zulip-flutter/pull/643#issuecomment-2093940972
402
+
403
+ // TODO Fix bug causing our implementation's results to differ from the
404
+ // replit's. Where they differ, see comment with what the replit gives.
405
+
406
+ runCheck (0xff76ce90 , const Color (0xff73cb8d ));
407
+ runCheck (0xfffae589 , const Color (0xffccb95f )); // 0xffcbb85e
408
+ runCheck (0xffa6c7e5 , const Color (0xff9cbcda )); // 0xff9cbddb
409
+ runCheck (0xffe79ab5 , const Color (0xffe79ab5 ));
410
+ runCheck (0xffbfd56f , const Color (0xffacc25d ));
411
+ runCheck (0xfff4ae55 , const Color (0xfff0ab52 )); // 0xffefa951
412
+ runCheck (0xffb0a5fd , const Color (0xffb0a5fd ));
413
+ runCheck (0xffaddfe5 , const Color (0xff90c1c7 )); // 0xff90c2c8
414
+ runCheck (0xfff5ce6e , const Color (0xffd9b456 )); // 0xffd8b355
415
+ runCheck (0xffc2726a , const Color (0xffc2726a ));
416
+ runCheck (0xff94c849 , const Color (0xff94c849 ));
417
+ runCheck (0xffbd86e5 , const Color (0xffbd86e5 ));
418
+ runCheck (0xffee7e4a , const Color (0xffee7e4a ));
419
+ runCheck (0xffa6dcbf , const Color (0xff8fc4a8 ));
420
+ runCheck (0xff95a5fd , const Color (0xff95a5fd ));
421
+ runCheck (0xff53a063 , const Color (0xff53a063 ));
422
+ runCheck (0xff9987e1 , const Color (0xff9987e1 ));
423
+ runCheck (0xffe4523d , const Color (0xffe4523d ));
424
+ runCheck (0xffc2c2c2 , const Color (0xffb9b9b9 ));
425
+ runCheck (0xff4f8de4 , const Color (0xff4f8de4 ));
426
+ runCheck (0xffc6a8ad , const Color (0xffc6a8ad ));
427
+ runCheck (0xffe7cc4d , const Color (0xffd1b839 )); // 0xffd0b737
428
+ runCheck (0xffc8bebf , const Color (0xffc0b6b7 ));
429
+ runCheck (0xffa47462 , const Color (0xffa47462 ));
430
+ runCheck (0xffacc25d , const Color (0xffacc25d ));
431
+ });
432
+
433
+ test ('iconOnBarBackground' , () {
434
+ void runCheck (int base , Color expected) {
435
+ check (StreamColorSwatch .dark (base ))
436
+ .iconOnBarBackground.equals (expected);
437
+ }
438
+
439
+ // Check against everything in ZULIP_ASSIGNMENT_COLORS
440
+ // in <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>.
441
+ // (Skipping `streamColors` because there are 100+ of them.)
442
+ // On how to generate expected results, see:
443
+ // https://github.com/zulip/zulip-flutter/pull/643#issuecomment-2093940972
444
+
445
+ // TODO Fix bug causing our implementation's results to differ from the
446
+ // web app's. Where they differ, see comment with what web uses.
447
+
448
+ runCheck (0xff76ce90 , const Color (0xff73cb8d ));
449
+ runCheck (0xfffae589 , const Color (0xffccb95f )); // 0xffcbb85e
450
+ runCheck (0xffa6c7e5 , const Color (0xff9cbcda )); // 0xff9cbddb
451
+ runCheck (0xffe79ab5 , const Color (0xffe79ab5 ));
452
+ runCheck (0xffbfd56f , const Color (0xffacc25d ));
453
+ runCheck (0xfff4ae55 , const Color (0xfff0ab52 )); // 0xffefa951
454
+ runCheck (0xffb0a5fd , const Color (0xffb0a5fd ));
455
+ runCheck (0xffaddfe5 , const Color (0xff90c1c7 )); // 0xff90c2c8
456
+ runCheck (0xfff5ce6e , const Color (0xffd9b456 )); // 0xffd8b355
457
+ runCheck (0xffc2726a , const Color (0xffc2726a ));
458
+ runCheck (0xff94c849 , const Color (0xff94c849 ));
459
+ runCheck (0xffbd86e5 , const Color (0xffbd86e5 ));
460
+ runCheck (0xffee7e4a , const Color (0xffee7e4a ));
461
+ runCheck (0xffa6dcbf , const Color (0xff8fc4a8 ));
462
+ runCheck (0xff95a5fd , const Color (0xff95a5fd ));
463
+ runCheck (0xff53a063 , const Color (0xff53a063 ));
464
+ runCheck (0xff9987e1 , const Color (0xff9987e1 ));
465
+ runCheck (0xffe4523d , const Color (0xffe4523d ));
466
+ runCheck (0xffc2c2c2 , const Color (0xffb9b9b9 ));
467
+ runCheck (0xff4f8de4 , const Color (0xff4f8de4 ));
468
+ runCheck (0xffc6a8ad , const Color (0xffc6a8ad ));
469
+ runCheck (0xffe7cc4d , const Color (0xffd1b839 )); // 0xffd0b737
470
+ runCheck (0xffc8bebf , const Color (0xffc0b6b7 ));
471
+ runCheck (0xffa47462 , const Color (0xffa47462 ));
472
+ runCheck (0xffacc25d , const Color (0xffacc25d ));
473
+ });
474
+
475
+ test ('barBackground' , () {
476
+ void runCheck (int base , Color expected) {
477
+ check (StreamColorSwatch .dark (base ))
478
+ .barBackground.equals (expected);
479
+ }
480
+
481
+ // Check against everything in ZULIP_ASSIGNMENT_COLORS
482
+ // in <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>.
483
+ // (Skipping `streamColors` because there are 100+ of them.)
484
+ // On how to extract expected results from the replit, see:
485
+ // https://github.com/zulip/zulip-flutter/pull/643#issuecomment-2093940972
486
+
487
+ // TODO Fix bug causing our implementation's results to differ from the
488
+ // replit's. Where they differ, see comment with what the replit gives.
489
+
490
+ runCheck (0xff76ce90 , const Color (0xff2e4935 ));
491
+ runCheck (0xfffae589 , const Color (0xff4a4327 ));
492
+ runCheck (0xffa6c7e5 , const Color (0xff3a444e )); // 0xff3a454e
493
+ runCheck (0xffe79ab5 , const Color (0xff523a42 ));
494
+ runCheck (0xffbfd56f , const Color (0xff404627 ));
495
+ runCheck (0xfff4ae55 , const Color (0xff563f23 )); // 0xff553e23
496
+ runCheck (0xffb0a5fd , const Color (0xff413d59 ));
497
+ runCheck (0xffaddfe5 , const Color (0xff374648 ));
498
+ runCheck (0xfff5ce6e , const Color (0xff4e4224 )); // 0xff4e4124
499
+ runCheck (0xffc2726a , const Color (0xff472d2a ));
500
+ runCheck (0xff94c849 , const Color (0xff394821 )); // 0xff384821
501
+ runCheck (0xffbd86e5 , const Color (0xff453351 ));
502
+ runCheck (0xffee7e4a , const Color (0xff563120 ));
503
+ runCheck (0xffa6dcbf , const Color (0xff36473e ));
504
+ runCheck (0xff95a5fd , const Color (0xff393d59 ));
505
+ runCheck (0xff53a063 , const Color (0xff243c28 ));
506
+ runCheck (0xff9987e1 , const Color (0xff3a3350 ));
507
+ runCheck (0xffe4523d , const Color (0xff53241c )); // 0xff53241b
508
+ runCheck (0xffc2c2c2 , const Color (0xff434343 ));
509
+ runCheck (0xff4f8de4 , const Color (0xff263551 )); // 0xff253551
510
+ runCheck (0xffc6a8ad , const Color (0xff483e40 ));
511
+ runCheck (0xffe7cc4d , const Color (0xff4c431d )); // 0xff4c431c
512
+ runCheck (0xffc8bebf , const Color (0xff464243 ));
513
+ runCheck (0xffa47462 , const Color (0xff3d2d27 ));
514
+ runCheck (0xffacc25d , const Color (0xff404627 ));
515
+ });
516
+ });
517
+
322
518
test ('lerp (different a, b)' , () {
323
519
final swatchA = StreamColorSwatch (0xff76ce90 );
324
520
0 commit comments