diff --git a/uranos-api/src/main/kotlin/space/uranos/util/RGBColor.kt b/uranos-api/src/main/kotlin/space/uranos/util/RGBColor.kt index fa7e3e3..4db0c88 100644 --- a/uranos-api/src/main/kotlin/space/uranos/util/RGBColor.kt +++ b/uranos-api/src/main/kotlin/space/uranos/util/RGBColor.kt @@ -20,6 +20,8 @@ class RGBColor(rgb: Int) { val green: UByte by lazy { ((rgb and 0x00FF00) shr 8).toUByte() } val blue: UByte by lazy { (rgb and 0x0000FF).toUByte() } + fun copy(red: UByte = this.red, green: UByte = this.green, blue: UByte = this.blue) = RGBColor(red, green, blue) + override fun toString() = "0x${rgb.toString(16).toUpperCase().padStart(6, '0')}" override fun equals(other: Any?): Boolean = (other == this) || (other is RGBColor && other.rgb == this.rgb)