diff --git a/modules/resources/src/androidMain/kotlin/splitties/resources/ColorResources.kt b/modules/resources/src/androidMain/kotlin/splitties/resources/ColorResources.kt index d43aa67e..d4ddb401 100644 --- a/modules/resources/src/androidMain/kotlin/splitties/resources/ColorResources.kt +++ b/modules/resources/src/androidMain/kotlin/splitties/resources/ColorResources.kt @@ -93,19 +93,12 @@ inline fun View.styledColor(@AttrRes attr: Int) = context.styledColor(attr) inline fun appStyledColor(@AttrRes attr: Int) = appCtx.styledColor(attr) fun Context.styledColorSL(@AttrRes attr: Int): ColorStateList = withResolvedThemeAttribute(attr) { - when (resourceId) { - 0 -> { - require(type in TypedValue.TYPE_FIRST_COLOR_INT..TypedValue.TYPE_LAST_COLOR_INT) { - unexpectedThemeAttributeTypeErrorMessage(expectedKind = "color") - } - ColorStateList.valueOf(data) - } - else -> { - require(type == TypedValue.TYPE_STRING && string.startsWith("res/color/")) { - unexpectedThemeAttributeTypeErrorMessage(expectedKind = "color") - } - colorSL(resourceId) - } + if (type in TypedValue.TYPE_FIRST_COLOR_INT..TypedValue.TYPE_LAST_COLOR_INT) { + ColorStateList.valueOf(data) + } else if (type == TypedValue.TYPE_STRING && string.startsWith("res/color/")) { + colorSL(resourceId) + } else { + illegalArg(errorMessage = unexpectedThemeAttributeTypeErrorMessage(expectedKind = "color")) } }