We have enum of colors. For some logs, it is necessary to get the color code, which is the name of the color in lowercase. The colors will be updated in the future, so using pattern matching will not be very convenient.
Modify the Color so that you can get the code without knowing the specific type of this color:
val color: Color = Color.Red
println(color.code) // red
val color2: Color = Color.Blue
println(color2.code) // blue