fix: handle three characters lenght hexcode colors.

This commit is contained in:
aminecmi
2024-01-03 21:35:58 +01:00
parent 390c2d0cf3
commit 14ff4dbd05
2 changed files with 13 additions and 2 deletions

View File

@ -73,3 +73,13 @@ fun SelfossModel.Item.toEntity(): ITEM =
this.tags.joinToString(","),
this.author,
)
fun SelfossModel.Tag.getColorHexCode(): String =
if (this.color.length == 4) { // #000
val char1 = this.color.get(1)
val char2 = this.color.get(2)
val char3 = this.color.get(3)
"#$char1$char1$char2$char2$char3$char3"
} else {
this.color
}