Android convert color int to hexa String

前端 未结 3 1965
慢半拍i
慢半拍i 2020-12-30 18:27
public static int RGB(float[] hsv) {
    return Color.HSVToColor(hsv);
}

this function add an int, froma color. how can i convert that int to a he

3条回答
  •  遥遥无期
    2020-12-30 19:10

    If you want to convert to javascript format:

    val hexColor = String.format("%06X", 0xFFFFFFFF.and(R.color.text.toColorInt(context).toLong()))
    
    val javascriptHexColor = "#" + hexColor.substring(2) + hexColor.substring(0, 2)
    

提交回复
热议问题