add opportunity to create Hex from rgb

This commit is contained in:
InsanusMokrassar committed 2023-09-25 16:26:27 +06:00
1 parent 88f6b349ea
commit c92ed92f7c
2 files changed
+19 -17

No files matched your search

@@ -8,7 +8,9 @@ sealed interface Color {
value class BackgroundColor(override val value: String) : Color
@Serializable
value class Hex(override val value: String) : Color
value class Hex(override val value: String) : Color {
constructor(r: UByte, g: UByte, b: UByte) : this("#${r.toString(16)}${g.toString(16)}${b.toString(16)}")
}
companion object {
val BackgroundColor = BackgroundColor("bg_color")