For something like <https://github.com/material-fo...
# getting-started
k
For something like https://github.com/material-foundation/material-color-utilities/blob/main/kotlin/hct/Hct.kt#L158 which accepts a color as
Int
, passing in the encoded ARGB channels, is there a more "pleasant" way of replacing
Hct.fromInt(0xFFFF0000u.toInt())
with something closer to how it is in Java
Hct.fromInt(0xFFFF0000)
the trailing
u.toInt()
is just noise when I read this call. The only thing I can think of is adding my own
fun Hct.fromLong
extension to make it read better in Kotlin.
j
Maybe if they fix this issue, it will address the issue? Seems like an adjacent problem. I have some similar code which has to list a bunch of awt colors like this:
Color(0x80DC8300.toInt(), true)
k
Opened 9 years ago
y
I'd say just add your own:
Copy code
fun Hct.Companion.from(argb: UInt) = Hct.fromInt(argb.toInt())
1