[Colors] Update default profile image colors (colorFromName).

This commit is contained in:
Kuba Szczodrzyński 2020-01-05 14:39:19 +01:00
parent 3f19e5d465
commit 1589a05a37

View File

@ -210,25 +210,23 @@ fun List<String>.join(delimiter: String): String {
} }
fun colorFromName(name: String?): Int { fun colorFromName(name: String?): Int {
var crc = (name ?: "").crc16() val i = (name ?: "").crc32()
crc = (crc and 0xff) or (crc shr 8) return when ((i / 10 % 16 + 1).toInt()) {
crc %= 16
return when (crc) {
13 -> 0xffF44336 13 -> 0xffF44336
4 -> 0xffF50057 4 -> 0xffF50057
2 -> 0xffD500F9 2 -> 0xffD500F9
9 -> 0xff6200EA 9 -> 0xff6200EA
5 -> 0xff3F51B5 5 -> 0xffFFAB00
1 -> 0xff304FFE 1 -> 0xff304FFE
6 -> 0xff18FFFF 6 -> 0xff40C4FF
14 -> 0xff26A69A 14 -> 0xff26A69A
15 -> 0xff4CAF50 15 -> 0xff00C853
7 -> 0xffFFD600 7 -> 0xffFFD600
3 -> 0xffFF3D00 3 -> 0xffFF3D00
8 -> 0xffDD2C00 8 -> 0xffDD2C00
10 -> 0xff795548 10 -> 0xff795548
12 -> 0xffBDBDBD 12 -> 0xff2979FF
11 -> 0xff78909C 11 -> 0xffFF6D00
else -> 0xff64DD17 else -> 0xff64DD17
}.toInt() }.toInt()
} }