Add own RGBColor class
This commit is contained in:
parent
83b9124670
commit
4fafdcbbc5
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Reference in a new issue