1
1
import 'package:flutter/foundation.dart' ;
2
2
import 'package:flutter/painting.dart' ;
3
+ import 'package:flutter_color_models/flutter_color_models.dart' ;
3
4
import 'package:json_annotation/json_annotation.dart' ;
4
5
5
6
import '../../widgets/color.dart' ;
@@ -384,9 +385,15 @@ class StreamColorSwatch extends ColorSwatch<_StreamColorVariant> {
384
385
385
386
Color get unreadCountBadgeBackground => this [_StreamColorVariant .unreadCountBadgeBackground]! ;
386
387
388
+ Color get recipientBarIcon => this [_StreamColorVariant .recipientBarIcon]! ;
389
+
390
+ Color get recipientBarBackground => this [_StreamColorVariant .recipientBarBackground]! ;
391
+
387
392
static Map <_StreamColorVariant , Color > _compute (int base ) {
388
393
final baseAsColor = Color (base );
389
394
395
+ final clamped20to75 = clampLchLightness (baseAsColor, 20 , 75 );
396
+
390
397
return {
391
398
_StreamColorVariant .base : baseAsColor,
392
399
@@ -398,13 +405,34 @@ class StreamColorSwatch extends ColorSwatch<_StreamColorVariant> {
398
405
// TODO profiling for expensive computation
399
406
_StreamColorVariant .unreadCountBadgeBackground:
400
407
clampLchLightness (baseAsColor, 30 , 70 ).withOpacity (0.3 ),
408
+
409
+ // Follows `.recepeient__icon` in Vlad's replit, except (to match web)
410
+ // with a `.darken(0.12)` omitted:
411
+ // <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>
412
+ // <https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/design.3A.20.23F117.20.22Inbox.22.20screen/near/1624484>
413
+ //
414
+ // TODO await decision on that `.darken(0.12)` or another way to raise contrast:
415
+ // https://chat.zulip.org/#narrow/stream/101-design/topic/UI.20redesign.3A.20recipient.20bar.20colors/near/1675786
416
+ _StreamColorVariant .recipientBarIcon: clamped20to75,
417
+
418
+ // Follows `.recepient` in Vlad's replit:
419
+ // <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>
420
+ //
421
+ // TODO I think [LabColor.interpolate] doesn't actually do LAB mixing;
422
+ // it just calls up to the superclass method [ColorModel.interpolate]:
423
+ // <https://pub.dev/documentation/flutter_color_models/latest/flutter_color_models/ColorModel/interpolate.html>
424
+ // which does ordinary RGB mixing. Investigate and send a PR?
425
+ _StreamColorVariant .recipientBarBackground: LabColor .fromColor (const Color (0xfff9f9f9 ))
426
+ .interpolate (LabColor .fromColor (clamped20to75), 0.22 ),
401
427
};
402
428
}
403
429
}
404
430
405
431
enum _StreamColorVariant {
406
432
base ,
407
433
unreadCountBadgeBackground,
434
+ recipientBarIcon,
435
+ recipientBarBackground,
408
436
}
409
437
410
438
/// As in the get-messages response.
0 commit comments