Skip to content

Commit 60a8411

Browse files
chrisbobbegnprice
authored andcommitted
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 a276bb3 commit 60a8411

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,
@@ -143,9 +145,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
143145

144146
DesignVariables.dark() :
145147
this._(
148+
bgCounterUnread: const Color(0xff666699).withOpacity(0.37),
146149
bgTopBar: const Color(0xff242424),
147150
borderBar: Colors.black.withOpacity(0.41),
148151
icon: const Color(0xff7070c2),
152+
labelCounterUnread: const Color(0xffffffff).withOpacity(0.7),
149153
mainBackground: const Color(0xff1d1d1d),
150154
title: const Color(0xffffffff),
151155
channelColorSwatches: ChannelColorSwatches.dark,
@@ -157,9 +161,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
157161
);
158162

159163
DesignVariables._({
164+
required this.bgCounterUnread,
160165
required this.bgTopBar,
161166
required this.borderBar,
162167
required this.icon,
168+
required this.labelCounterUnread,
163169
required this.mainBackground,
164170
required this.title,
165171
required this.channelColorSwatches,
@@ -179,9 +185,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
179185
return extension!;
180186
}
181187

188+
final Color bgCounterUnread;
182189
final Color bgTopBar;
183190
final Color borderBar;
184191
final Color icon;
192+
final Color labelCounterUnread;
185193
final Color mainBackground;
186194
final Color title;
187195

@@ -196,9 +204,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
196204

197205
@override
198206
DesignVariables copyWith({
207+
Color? bgCounterUnread,
199208
Color? bgTopBar,
200209
Color? borderBar,
201210
Color? icon,
211+
Color? labelCounterUnread,
202212
Color? mainBackground,
203213
Color? title,
204214
ChannelColorSwatches? channelColorSwatches,
@@ -208,9 +218,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
208218
Color? unreadCountBadgeTextForChannel,
209219
}) {
210220
return DesignVariables._(
221+
bgCounterUnread: bgCounterUnread ?? this.bgCounterUnread,
211222
bgTopBar: bgTopBar ?? this.bgTopBar,
212223
borderBar: borderBar ?? this.borderBar,
213224
icon: icon ?? this.icon,
225+
labelCounterUnread: labelCounterUnread ?? this.labelCounterUnread,
214226
mainBackground: mainBackground ?? this.mainBackground,
215227
title: title ?? this.title,
216228
channelColorSwatches: channelColorSwatches ?? this.channelColorSwatches,
@@ -227,9 +239,11 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
227239
return this;
228240
}
229241
return DesignVariables._(
242+
bgCounterUnread: Color.lerp(bgCounterUnread, other.bgCounterUnread, t)!,
230243
bgTopBar: Color.lerp(bgTopBar, other.bgTopBar, t)!,
231244
borderBar: Color.lerp(borderBar, other.borderBar, t)!,
232245
icon: Color.lerp(icon, other.icon, t)!,
246+
labelCounterUnread: Color.lerp(labelCounterUnread, other.labelCounterUnread, t)!,
233247
mainBackground: Color.lerp(mainBackground, other.mainBackground, t)!,
234248
title: Color.lerp(title, other.title, t)!,
235249
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)