Skip to content

Commit 353ba36

Browse files
committed
unread_badge_count [nfc]: Use new Figma design variables in neutral variant
These are the same colors in light mode -- with the background color refactored to match Figma's representation as hex with a percent opacity -- so this is NFC, since we don't support dark mode yet. But since these are settled variables in the new Figma, we now have dark-theme variants for these!
1 parent 0323631 commit 353ba36

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

lib/widgets/theme.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ const kZulipBrandColor = Color.fromRGBO(0x64, 0x92, 0xfe, 1);
129129
class DesignVariables extends ThemeExtension<DesignVariables> {
130130
DesignVariables.light() :
131131
this._(
132+
bgCounterUnread: const Color(0xff666699).withOpacity(0.15),
132133
bgTopBar: const Color(0xfff5f5f5),
133134
borderBar: const Color(0x33000000),
134135
icon: const Color(0xff666699),
136+
labelCounterUnread: const Color(0xff222222),
135137
mainBackground: const Color(0xfff0f0f0),
136138
title: const Color(0xff1a1a1a),
137139
channelColorSwatches: ChannelColorSwatches.light,
@@ -141,9 +143,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
141143

142144
DesignVariables.dark() :
143145
this._(
146+
bgCounterUnread: const Color(0xff666699).withOpacity(0.37),
144147
bgTopBar: const Color(0xff242424),
145148
borderBar: Colors.black.withOpacity(0.41),
146149
icon: const Color(0xff7070c2),
150+
labelCounterUnread: const Color(0xffffffff).withOpacity(0.7),
147151
mainBackground: const Color(0xff1d1d1d),
148152
title: const Color(0xffffffff),
149153
channelColorSwatches: ChannelColorSwatches.dark,
@@ -153,9 +157,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
153157
);
154158

155159
DesignVariables._({
160+
required this.bgCounterUnread,
156161
required this.bgTopBar,
157162
required this.borderBar,
158163
required this.icon,
164+
required this.labelCounterUnread,
159165
required this.mainBackground,
160166
required this.title,
161167
required this.channelColorSwatches,
@@ -173,9 +179,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
173179
return extension!;
174180
}
175181

182+
final Color bgCounterUnread;
176183
final Color bgTopBar;
177184
final Color borderBar;
178185
final Color icon;
186+
final Color labelCounterUnread;
179187
final Color mainBackground;
180188
final Color title;
181189

@@ -188,19 +196,23 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
188196

189197
@override
190198
DesignVariables copyWith({
199+
Color? bgCounterUnread,
191200
Color? bgTopBar,
192201
Color? borderBar,
193202
Color? icon,
203+
Color? labelCounterUnread,
194204
Color? mainBackground,
195205
Color? title,
196206
ChannelColorSwatches? channelColorSwatches,
197207
Color? star,
198208
Color? unreadCountBadgeTextForChannel,
199209
}) {
200210
return DesignVariables._(
211+
bgCounterUnread: bgCounterUnread ?? this.bgCounterUnread,
201212
bgTopBar: bgTopBar ?? this.bgTopBar,
202213
borderBar: borderBar ?? this.borderBar,
203214
icon: icon ?? this.icon,
215+
labelCounterUnread: labelCounterUnread ?? this.labelCounterUnread,
204216
mainBackground: mainBackground ?? this.mainBackground,
205217
title: title ?? this.title,
206218
channelColorSwatches: channelColorSwatches ?? this.channelColorSwatches,
@@ -215,9 +227,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
215227
return this;
216228
}
217229
return DesignVariables._(
230+
bgCounterUnread: Color.lerp(bgCounterUnread, other.bgCounterUnread, t)!,
218231
bgTopBar: Color.lerp(bgTopBar, other.bgTopBar, t)!,
219232
borderBar: Color.lerp(borderBar, other.borderBar, t)!,
220233
icon: Color.lerp(icon, other.icon, t)!,
234+
labelCounterUnread: Color.lerp(labelCounterUnread, other.labelCounterUnread, t)!,
221235
mainBackground: Color.lerp(mainBackground, other.mainBackground, t)!,
222236
title: Color.lerp(title, other.title, t)!,
223237
channelColorSwatches: ChannelColorSwatches.lerp(channelColorSwatches, other.channelColorSwatches, t),

lib/widgets/unread_count_badge.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class UnreadCountBadge extends StatelessWidget {
3434
final effectiveBackgroundColor = switch (backgroundColor) {
3535
ChannelColorSwatch(unreadCountBadgeBackground: var color) => color,
3636
Color() => backgroundColor,
37-
// TODO(#95) need dark-theme color
38-
null => const Color.fromRGBO(102, 102, 153, 0.15),
37+
null => designVariables.bgCounterUnread,
3938
};
4039

4140
return DecoratedBox(
@@ -50,13 +49,9 @@ class UnreadCountBadge extends StatelessWidget {
5049
fontSize: 16,
5150
height: (18 / 16),
5251
fontFeatures: const [FontFeature.enable('smcp')], // small caps
53-
54-
// From the Figma:
55-
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=171-12359&mode=design&t=JKrw76SGUF51nSJG-0
56-
// TODO(#95) need dark-theme color
5752
color: backgroundColor is ChannelColorSwatch
5853
? designVariables.unreadCountBadgeTextForChannel
59-
: const Color(0xFF222222),
54+
: designVariables.labelCounterUnread,
6055
).merge(weightVariableTextStyle(context,
6156
wght: bold ? 600 : null)),
6257
count.toString())));

0 commit comments

Comments
 (0)