Add Color conversion options (add hsla -> hex)

This commit is contained in:
2021-07-08 16:15:42 +02:00
parent 9e43f5b746
commit adec3b21b0
4 changed files with 10 additions and 8 deletions

View File

@@ -63,7 +63,11 @@ class Color(value: String) : CssProperty(value) {
}
}
fun toHex(): String = toRGBA().asHex()
fun toHex(): String = if (isHsla() || isHsl()) {
fromHSLANotation().asRGBA().asHex()
} else {
toRGBA().asHex()
}
fun isHsla(): Boolean {
val v = rgb ?: value