andrew
10/25/2019, 12:09 AMcolorResource
for decoding color references?kioba
10/25/2019, 12:17 AMColor(color: Long)
which expects a The 32-bit ARGB color int
and a Color(@ColorInt color: Int)
which needs a resourceandrew
10/25/2019, 12:19 AMandrew
10/25/2019, 12:19 AMjim
10/25/2019, 12:22 AM@ColorInt
Denotes that the annotated element represents a packed color, right?kioba
10/25/2019, 12:23 AMrepresents a packed color int, {@code AARRGGBB}
jim
10/25/2019, 12:23 AMcolorResource()
yet, but it should be an easy function to write. Hint hint, could be a good first bug if someone is looking to submit a pull request 🙂.kioba
10/25/2019, 12:34 AM@CheckResult(suggest = "+")
fun colorResource(@ColorRes resId: Int) = effectOf<Color> {
val context = +ambient(ContextAmbient)
val res = context.resources
+memo(resId) {
Color(ContextCompat.getColor(context, resId))
}
}