@@ -76,67 +76,67 @@ class _ChannelColorSwatchesLerped extends ChannelColorSwatches {
76
76
///
77
77
/// Use this in UI code for colors related to [Subscription.color] ,
78
78
/// such as the background of an unread count badge.
79
- class ChannelColorSwatch extends ColorSwatch <StreamColorVariant > {
79
+ class ChannelColorSwatch extends ColorSwatch <ChannelColorVariant > {
80
80
ChannelColorSwatch .light (int base ) : this ._(base , _computeLight (base ));
81
81
ChannelColorSwatch .dark (int base ) : this ._(base , _computeDark (base ));
82
82
83
83
const ChannelColorSwatch ._(int base , this ._swatch) : super (base , _swatch);
84
84
85
- final Map <StreamColorVariant , Color > _swatch;
85
+ final Map <ChannelColorVariant , Color > _swatch;
86
86
87
87
/// The [Subscription.color] int that the swatch is based on.
88
- Color get base => this [StreamColorVariant .base ]! ;
88
+ Color get base => this [ChannelColorVariant .base ]! ;
89
89
90
- Color get unreadCountBadgeBackground => this [StreamColorVariant .unreadCountBadgeBackground]! ;
90
+ Color get unreadCountBadgeBackground => this [ChannelColorVariant .unreadCountBadgeBackground]! ;
91
91
92
92
/// The stream icon on a plain-colored surface, such as white.
93
93
///
94
94
/// For the icon on a [barBackground] -colored surface,
95
95
/// use [iconOnBarBackground] instead.
96
- Color get iconOnPlainBackground => this [StreamColorVariant .iconOnPlainBackground]! ;
96
+ Color get iconOnPlainBackground => this [ChannelColorVariant .iconOnPlainBackground]! ;
97
97
98
98
/// The stream icon on a [barBackground] -colored surface.
99
99
///
100
100
/// For the icon on a plain surface, use [iconOnPlainBackground] instead.
101
101
/// This color is chosen to enhance contrast with [barBackground] :
102
102
/// <https://github.com/zulip/zulip/pull/27485>
103
- Color get iconOnBarBackground => this [StreamColorVariant .iconOnBarBackground]! ;
103
+ Color get iconOnBarBackground => this [ChannelColorVariant .iconOnBarBackground]! ;
104
104
105
105
/// The background color of a bar representing a stream, like a recipient bar.
106
106
///
107
107
/// Use this in the message list, the "Inbox" view, and the "Streams" view.
108
- Color get barBackground => this [StreamColorVariant .barBackground]! ;
108
+ Color get barBackground => this [ChannelColorVariant .barBackground]! ;
109
109
110
- static Map <StreamColorVariant , Color > _computeLight (int base ) {
110
+ static Map <ChannelColorVariant , Color > _computeLight (int base ) {
111
111
final baseAsColor = Color (base );
112
112
113
113
final clamped20to75 = clampLchLightness (baseAsColor, 20 , 75 );
114
114
final clamped20to75AsHsl = HSLColor .fromColor (clamped20to75);
115
115
116
116
return {
117
- StreamColorVariant .base : baseAsColor,
117
+ ChannelColorVariant .base : baseAsColor,
118
118
119
119
// Follows `.unread-count` in Vlad's replit:
120
120
// <https://replit.com/@VladKorobov/zulip-sidebar#script.js>
121
121
// <https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/design.3A.20.23F117.20.22Inbox.22.20screen/near/1624484>
122
122
//
123
123
// TODO fix bug where our results differ from the replit's (see unit tests)
124
- StreamColorVariant .unreadCountBadgeBackground:
124
+ ChannelColorVariant .unreadCountBadgeBackground:
125
125
clampLchLightness (baseAsColor, 30 , 70 )
126
126
.withOpacity (0.3 ),
127
127
128
128
// Follows `.sidebar-row__icon` in Vlad's replit:
129
129
// <https://replit.com/@VladKorobov/zulip-sidebar#script.js>
130
130
//
131
131
// TODO fix bug where our results differ from the replit's (see unit tests)
132
- StreamColorVariant .iconOnPlainBackground: clamped20to75,
132
+ ChannelColorVariant .iconOnPlainBackground: clamped20to75,
133
133
134
134
// Follows `.recepeient__icon` in Vlad's replit:
135
135
// <https://replit.com/@VladKorobov/zulip-topic-feed-colors#script.js>
136
136
// <https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/design.3A.20.23F117.20.22Inbox.22.20screen/near/1624484>
137
137
//
138
138
// TODO fix bug where our results differ from the replit's (see unit tests)
139
- StreamColorVariant .iconOnBarBackground:
139
+ ChannelColorVariant .iconOnBarBackground:
140
140
clamped20to75AsHsl
141
141
.withLightness (clampDouble (clamped20to75AsHsl.lightness - 0.12 , 0.0 , 1.0 ))
142
142
.toColor (),
@@ -149,14 +149,14 @@ class ChannelColorSwatch extends ColorSwatch<StreamColorVariant> {
149
149
// <https://pub.dev/documentation/flutter_color_models/latest/flutter_color_models/ColorModel/interpolate.html>
150
150
// which does ordinary RGB mixing. Investigate and send a PR?
151
151
// TODO fix bug where our results differ from the replit's (see unit tests)
152
- StreamColorVariant .barBackground:
152
+ ChannelColorVariant .barBackground:
153
153
LabColor .fromColor (const Color (0xfff9f9f9 ))
154
154
.interpolate (LabColor .fromColor (clamped20to75), 0.22 )
155
155
.toColor (),
156
156
};
157
157
}
158
158
159
- static Map <StreamColorVariant , Color > _computeDark (int base ) {
159
+ static Map <ChannelColorVariant , Color > _computeDark (int base ) {
160
160
final baseAsColor = Color (base );
161
161
162
162
final clamped20to75 = clampLchLightness (baseAsColor, 20 , 75 );
@@ -166,11 +166,11 @@ class ChannelColorSwatch extends ColorSwatch<StreamColorVariant> {
166
166
// on, and how the resulting values are a little off sometimes. The
167
167
// comments mostly apply here too.
168
168
169
- StreamColorVariant .base : baseAsColor,
170
- StreamColorVariant .unreadCountBadgeBackground:
169
+ ChannelColorVariant .base : baseAsColor,
170
+ ChannelColorVariant .unreadCountBadgeBackground:
171
171
clampLchLightness (baseAsColor, 30 , 70 )
172
172
.withOpacity (0.3 ),
173
- StreamColorVariant .iconOnPlainBackground: clamped20to75,
173
+ ChannelColorVariant .iconOnPlainBackground: clamped20to75,
174
174
175
175
// Follows the web app (as of zulip/zulip@db03369ac); see
176
176
// get_stream_privacy_icon_color in web/src/stream_color.ts.
@@ -185,9 +185,9 @@ class ChannelColorSwatch extends ColorSwatch<StreamColorVariant> {
185
185
// https://chat.zulip.org/#narrow/stream/101-design/topic/UI.20redesign.3A.20recipient.20bar.20colors/near/1675786
186
186
//
187
187
// TODO fix bug where our results are unexpected (see unit tests)
188
- StreamColorVariant .iconOnBarBackground: clamped20to75,
188
+ ChannelColorVariant .iconOnBarBackground: clamped20to75,
189
189
190
- StreamColorVariant .barBackground:
190
+ ChannelColorVariant .barBackground:
191
191
LabColor .fromColor (const Color (0xff000000 ))
192
192
.interpolate (LabColor .fromColor (clamped20to75), 0.38 )
193
193
.toColor (),
@@ -199,7 +199,7 @@ class ChannelColorSwatch extends ColorSwatch<StreamColorVariant> {
199
199
if (identical (a, b)) {
200
200
return a;
201
201
}
202
- final Map <StreamColorVariant , Color > swatch;
202
+ final Map <ChannelColorVariant , Color > swatch;
203
203
if (b == null ) {
204
204
swatch = a! ._swatch.map ((key, color) => MapEntry (key, Color .lerp (color, null , t)! ));
205
205
} else {
@@ -214,7 +214,7 @@ class ChannelColorSwatch extends ColorSwatch<StreamColorVariant> {
214
214
}
215
215
216
216
@visibleForTesting
217
- enum StreamColorVariant {
217
+ enum ChannelColorVariant {
218
218
base ,
219
219
unreadCountBadgeBackground,
220
220
iconOnPlainBackground,
0 commit comments