Commit 8feb9dfc authored by Wilko Manger's avatar Wilko Manger

Use brigher colors for users in dark mode

Also remove the greyscale user color
parent 20bd8fb7
......@@ -90,7 +90,7 @@ abstract class MessageBubbleState<T extends MessageBubble>
TextStyle senderTextStyle(BuildContext context, {Color color}) {
if (color == null) {
color = colorOf(widget.event.sender);
color = colorOf(context, widget.event.sender);
}
return textStyle(context, color: color).copyWith(
......
......@@ -190,7 +190,7 @@ class TextBubbleState extends MessageBubbleState<TextBubble> {
child: CustomPaint(
painter: needsBorder
? ReplyBorderPainter(
color: colorOf(widget.event.sender),
color: colorOf(context, widget.event.sender),
)
: null,
child: Padding(
......
......@@ -140,7 +140,7 @@ class ChatOverviewPageState extends State<ChatOverviewPage> {
avatar = CircleAvatar(
foregroundColor: Colors.white,
backgroundColor: chat.room.isDirect
? colorOf(chat.room.directUser)
? colorOf(context, chat.room.directUser)
: LightColors.red[500],
radius: 24,
child: Icon(chat.room.isDirect ? Icons.person : Icons.group),
......
......@@ -40,7 +40,7 @@ class UserAvatar extends StatelessWidget {
);
} else {
return CircleAvatar(
backgroundColor: colorOf(user),
backgroundColor: colorOf(context, user),
radius: radius,
child: Icon(
Icons.person,
......
......@@ -53,6 +53,12 @@ Color redOnBackground(BuildContext context) {
);
}
Color userColor(BuildContext context, int index) => themed(
context,
light: LightColors.userColors[index],
dark: DarkColors.userColors[index],
);
class LightColors {
LightColors._();
......@@ -82,7 +88,19 @@ class LightColors {
Color(0xFF076678),
Color(0xFF8F3F71),
Color(0xFF427B58),
Color(0xFF3C3836),
Color(0xFFAF3A03),
];
}
class DarkColors {
DarkColors._();
static const userColors = [
Color(0xFFE7DF35),
Color(0xFFECB258),
Color(0xFF25D1F2),
Color(0xFFC780AC),
Color(0xFF81BB98),
Color(0xFFFB783C),
];
}
......@@ -47,5 +47,5 @@ String displayNameOf(User user, [BuildContext context]) =>
String displayNameOrId(UserId id, String name) =>
_limited(name) ?? id.toString().split(':')[0];
Color colorOf(User user) =>
LightColors.userColors[user.id.hashCode % LightColors.userColors.length];
Color colorOf(BuildContext context, User user) =>
userColor(context, user.id.hashCode % LightColors.userColors.length);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment