You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As RGB, and (I believe) all other implementations of Color are all data classes, they expose a copy constructor. I personally find this extremely convenient & useful for modifying a single component of a colour, instead of having to use map.
However, in recent versions of kotlin, the following warning is emitted:
w: This 'copy()' exposes the non-public primary constructor of a 'data class'. Please migrate the usage. See the appropriate 'data class' documentation or contact the 'data class' author for migration guidance. This will become an error in Kotlin 2.1.
this is due to the constructor being marked as internal.
would it be possible to methods that do the same thing as copy, allowing you to create a new instance of the colour, changing some fields?
The text was updated successfully, but these errors were encountered:
As
RGB
, and (I believe) all other implementations ofColor
are all data classes, they expose acopy
constructor. I personally find this extremely convenient & useful for modifying a single component of a colour, instead of having to usemap
.For example:
However, in recent versions of kotlin, the following warning is emitted:
this is due to the constructor being marked as
internal
.would it be possible to methods that do the same thing as
copy
, allowing you to create a new instance of the colour, changing some fields?The text was updated successfully, but these errors were encountered: