カラーピッカーの文字列解釈を変更
This commit is contained in:
parent
8241a6f377
commit
422e21c28a
|
@ -16,8 +16,8 @@ class TestColorString {
|
|||
assertEquals("#$s", expect, parseColorString("#$s"))
|
||||
}
|
||||
a("", Color.BLACK)
|
||||
a("8", Color.BLACK or 0x00_00_88)
|
||||
a("56", Color.BLACK or 0x00_00_56)
|
||||
a("8", Color.BLACK or 0x88_88_88)
|
||||
a("56", Color.BLACK or 0x55_66_00)
|
||||
a("123", Color.BLACK or 0x11_22_33)
|
||||
a("1234", 0x11_22_33_44)
|
||||
a("12345", Color.BLACK or 0x12_34_55)
|
||||
|
|
|
@ -14,8 +14,8 @@ fun parseColorString(src: String): Int {
|
|||
|
||||
return when (src.length - start) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.argb(255, 0, 0, c1(0))
|
||||
2 -> Color.argb(255, 0, 0, c2(0))
|
||||
1 -> Color.argb(255, c1(0), c1(0), c1(0))
|
||||
2 -> Color.argb(255, c1(0), c1(1), 0)
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue