OK, so second try: ``` data class Color private co...
# announcements
p
OK, so second try:
Copy code
data class Color private constructor(
        val red: Int,
        val green: Int,
        val blue: Int
) {
    companion object {

        fun of(redAsText: String, greenAsText: String, blueAsText: String): Color {
            val red = try {
                redAsText.toInt()
            } catch (t: Throwable) {
                throw IllegalArgumentException("Red pigment is invalid.")
            }
            if (red < 0 || red > 255) throw IllegalArgumentException("Red pigment is invalid.")
            // etc.
            return Color(red, green, blue)
        }

    }
}