lerp utility function throwing unexpected exception
Closed this issue · 2 comments
onomated commented
Describe the bug
lerp
function throws an exception IllegalArgumentException
. This is a result of the lerp function converting to the LAB
colorspace, and then attempting to convert to back to sRBG color space. See stack below:
Caused by: java.lang.IllegalArgumentException: RgbaColor needs to have a ColorModel of RGB
at com.chrynan.colors.BaseRgbaColor.<init>(BaseRgbaColor.kt:13)
at com.chrynan.colors.BaseRgbaColor.<init>(Unknown Source:0)
at com.chrynan.colors.ColorConstructorUtilsKt.RgbaColor(ColorConstructorUtils.kt:245)
at com.chrynan.colors.ColorUtilsKt.lerp(ColorUtils.kt:103)
To Reproduce
Steps to reproduce the behavior:
- Invoke this function
fun test(color: Long): Color {
return lerp(Color(color), Color.White, 50.0)
}
Expected behavior
Return the linear interpolated color
Additional context
Utilizing in KMM project
github-actions commented
Welcome and thanks for contributing! Make sure to leave a detailed explanation of the issue.
chRyNaN commented
Thanks @onomated Good catch! This should be fixed in the latest release. Feel free to create another issue if it is still occurring.
https://github.com/chRyNaN/colors/releases/tag/0.8.0
ee0c169