package cl.homelogic.platform.designsystem.extensions

import androidx.compose.ui.graphics.Color
import kotlin.math.roundToInt

fun Color.toHexString(): String {
    val red = (this.red * 255).roundToInt()
    val green = (this.green * 255).roundToInt()
    val blue = (this.blue * 255).roundToInt()

    return "#" + red.toHexString() +
        green.toHexString() + blue.toHexString()
}

private fun Int.toHexString(): String = this.toString(16).padStart(2, '0').uppercase()
