カラーピッカーの文字列解釈を変更

This commit is contained in:
tateisu 2021-11-22 08:20:21 +09:00
parent 422e21c28a
commit 43c1046f02
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class TestColorString {
}
a("", Color.BLACK)
a("8", Color.BLACK or 0x88_88_88)
a("56", Color.BLACK or 0x55_66_00)
a("56", Color.BLACK or 0x55_66_80)
a("123", Color.BLACK or 0x11_22_33)
a("1234", 0x11_22_33_44)
a("12345", Color.BLACK or 0x12_34_55)

View File

@ -15,7 +15,7 @@ fun parseColorString(src: String): Int {
return when (src.length - start) {
0 -> Color.BLACK
1 -> Color.argb(255, c1(0), c1(0), c1(0))
2 -> Color.argb(255, c1(0), c1(1), 0)
2 -> Color.argb(255, c1(0), c1(1), 0x80)
3 -> Color.argb(255, c1(0), c1(1), c1(2))
4 -> Color.argb(c1(0), c1(1), c1(2), c1(3))
5 -> Color.argb(255, c2(0), c2(2), c1(4))